Re: Part

• Subject: [mg2938] Re: [mg2890] Part
• From: fateman at peoplesparc.cs.berkeley.edu (Richard J Fateman)
• Date: 13 Jan 1996 05:26:15 -0600
• Approved: usenet@wri.com
• Distribution: local
• Newsgroups: wri.mathgroup
• Organization: University of California, Berkeley
• Sender: mj at wri.com

```In article <4d20j4\$ejt at dragonfly.wri.com>,
David Rosky <groskyd at gv.ssi1.com> 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 cs.berkeley.edu   http://http.cs.berkeley.edu/~fateman/

```

• Prev by Date: "Compile[]" and "InterpolatingFunction" objects
• Next by Date: Re: Unix Kernel with Windows frontend?
• Previous by thread: Re: Part