Re: Pattern of a List of Pairs
- To: mathgroup at smc.vnet.net
- Subject: [mg20889] Re: Pattern of a List of Pairs
- From: "DIAMOND Mark" <noname at noname.com>
- Date: Sat, 20 Nov 1999 01:07:04 -0500 (EST)
- Organization: The University of Western Australia
- References: <812ajv$1hc@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hans Steffani wrote in message <812ajv$1hc at smc.vnet.net>...
>I need a function wich gets a list of pairs. How do I build
>the head of this function.
>
It is not clear exactly what you mean. Do you mean that you want the
function header for a function which will ONLY accept a list of pairs of
numbers, in which case something like
f[ xypairs:{{_Real,_Real}..}] :=
will give you what you want. This
checks for a list of one or more pairs of real numbers. Changing to three
dots
f[ xypairs:{{_Real,_Real}...}] :=
will accept an empty list
Changing to
f[ xypairs:{{_?NumericQ, _?NumericQ}..}] :=
will check for numeric values, not necessarily real. Look at the
documentation for Pattern (and related words and headings) in the master
index.