Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: How to print large graphics cells?
  • Next by Date: Re: Yet another Mathematica docs whopper
  • Previous by thread: Re: Length of actual parameters in a function call.
  • Next by thread: Re: Re: Length of actual parameters in a function call.