Re: Length of actual parameters in a function call.
- To: mathgroup at smc.vnet.net
- Subject: [mg47124] Re: Length of actual parameters in a function call.
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 26 Mar 2004 03:56:33 -0500 (EST)
- Organization: The University of Western Australia
- References: <c3udpe$9om$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <c3udpe$9om$1 at smc.vnet.net>,
"E. Martin-Serrano" <eMartinSerrano at houston.rr.com> wrote:
> A few weeks ago, reviewing some tutorials on pattern matching and error
> handling, I came across an undocumented function to monitor the number of
> parameters submitted to a function in a call; but somehow I lost its track
> later. I guess that it must be something well-known by our specialists. Any
> help about where to locate it?
>
> The undocumented feature helps in tracking situations as when we define
> "MyFunction[a_,b_,c_]:= something" and then it is called as "myFunction[a]"
> leaving the function unevaluated.
MyFunction[a_, b_, c_] := something
MyFunction[args___] := Null /; Length[{args}] != 3 &&
Message[MyFunction::argx, MyFunction, Length[{args}]]
MyFunction[a]
Cheers,
Paul
--
Paul Abbott Phone: +61 8 9380 2734
School of Physics, M013 Fax: +61 8 9380 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul
- Follow-Ups:
- Re: Re: Length of actual parameters in a function call.
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Length of actual parameters in a function call.