MathGroup Archive 1996

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

Search the Archive

Re: Part

  • To: mathgroup at
  • Subject: [mg2938] Re: [mg2890] Part
  • From: fateman at (Richard J Fateman)
  • Date: Sat, 13 Jan 1996 03:20:28 -0500
  • Organization: University of California, Berkeley

In article <4d20j4$ejt at>,
David Rosky <groskyd at> wrote:

>Even though Sequence is not documented in the book, it is documented
>on-line as a form:
>In[2]:= ?Sequence
>Sequence[e1,e2,...] is a special form representing a sequence of arguments in
>   an expression.
>It appears that Sequence is the "head" which is internally given to any list of 
>elements which doesn't have an explicit head.  Maybe it is an internal form 
>normally used to keep track of lists of arguments to functions and the like.

Sequence is a very important component of Mathematica that is
necessary to deal with matched arguments to a function that collectively
may not have a "Head".  For example, what is the head of b, when 
f[a_,b__] matches f[1,2,3,4]?  It can't have a "real" head, say r,
 because then a replacement g[b] would look like g[r[2,3,4]]  instead
of g[2,3,4].  This "splicing" head is a pretty much inevitable
consequence of this type of pattern matching.  It is an interesting
tribute to the Mathematica book that so many readers think the
book is clear, and that they understand it, and yet so people
realize that there is this essential undocumented feature at the
heart of pattern matching.

 Other books that discuss pattern matching and this phenomenon
are around (e.g. you might see Peter Norvig: Paradigms of AI Programming).

Mathematica was not the first system to use pattern-match/replacement
as a fundamental tool. 
Richard J. Fateman
fateman at


  • Prev by Date: "Compile[]" and "InterpolatingFunction" objects
  • Next by Date: "Compile[]" and "InterpolatingFunction" objects
  • Previous by thread: Re: Part
  • Next by thread: Re: Part