MathGroup Archive 2010

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

Search the Archive

Re: SyntaxInformation Question

  • To: mathgroup at
  • Subject: [mg110772] Re: SyntaxInformation Question
  • From: "E. Martin-Serrano" <eMartinSerrano at>
  • Date: Mon, 5 Jul 2010 21:13:46 -0400 (EDT)


Sorry for the previous post that looks almost unreadable on my screen
probably due to problems with hidden special characters which distort the
page format and others. I hope this one reads better. 


In the ref/SyntaxInformation in the Help the following example can be found:

"f can have any number of arguments, but each should be a two-element list:"

SyntaxInformation[f] = {"ArgumentsPattern" -> {{_, _} ...}};

{f[{x, y}, {a, b}], f[x, {a, b}, {x, y, z}]};

In the first part of the example: 'f[{x, y}, {a, b}]', '{x, y}' is a
two-elements list, so is '{a, b}'; then syntax constrain holds and it is
understandable for me.

In the second part of the example: 'f[x, {a, b}, {x, y, z}]', 'x' evaluates
to a list but not necessarily to a two-elements list. According to the
scarce explanation given in the example, it is not excluded for 'x' to
evaluate to a 12-elements list '{x, y}', however the syntax constrain allows
it to pass; following with the example the list '{a, b}' is again a
two-elements list, so it pass the check. But finally '{x, y, z}' is a
three-elements list but it is allowed to pass the constrain too; and so do
{v, x, y, z}, and {u, v, x, y, z}, and any list of whatever any other length
as this {f[{x, y}, {a, b}], f[x, {a, b}, Array[100, x]]}.

In the example
Options[f]={aaa->1,bbb->2,ccc -> 4};

the syntax specification allows for two parameters and a list of options to
be submitted to the function 'f[]'. But it does no seem to work as expected
since the following is allowed to pass (and it seems Ok since just two
parameters and a list of options are submitted)

f[x,y, aaa->2,bbb->3,ccc ->4];

but the following is allowed to pass too, despite, in this case, 6
parameters (plus the options) are submitted instead of just the two
parameters specified in the SyntaxInformation[f] definition 

f[x, y, z, k, l, m, aaa->2,bbb->3,ccc->4];

I am certainly missing something important here and, clearly, I do not
understand the explanation given for this very basic command. So I would
appreciate any clarification from the Group.

Or maybe Wolfram should provide a complete tutorial on it or a clearer


E. Martin-Serrano

  • Prev by Date: Re: precedence for ReplaceAll?
  • Next by Date: Re: SyntaxInformation Question
  • Previous by thread: SyntaxInformation Question
  • Next by thread: Re: SyntaxInformation Question