Re: Function, Command, Operator, Object...etc.

*To*: mathgroup at smc.vnet.net*Subject*: [mg61463] Re: Function, Command, Operator, Object...etc.*From*: "Steven T. Hatton" <hattons at globalsymmetry.com>*Date*: Wed, 19 Oct 2005 02:17:26 -0400 (EDT)*References*: <200510160418.AAA22613@smc.vnet.net> <dj27iv$bnn$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Chris Chiasson wrote: > Maybe I am wrong, but pretty much every expression has a head and zero > or more slots. That's it. I believe it would be more correct to say every expression has a head. (anonymous functions?), and zero or more sub-expressions. I'm not sure if slots have relevance beyond anonymous functions. That is, in f[a_,b_]:=a+b a_ and b_ are patterns, not slots. Using the definition of f shown, we could write f[#,#]& which says evaluate f[a_,b_] with both a and b replaced with slot 1. Evaluating this: HoldPattern[f[a_,b_]:=a+b]//FullForm gives: HoldPattern[ SetDelayed[f[Pattern[a, Blank[]], Pattern[b, Blank[]]], Plus[a, b]]] > I wonder if a pattern is an expression... From the looks of the above, I would say yes. IIRC, the early editions Mathematica Book asserted that everything was a "list", rather than "expression". I might be wrong about that, but I am confident that something gave me that idea years ago. Here's a 5¢ tour of my current understanding of how Mathematica works: What Mathematica does is to take whatever input it is given, read through it evaluating each expression it encounters by looking for transformation rules which result in a more specific form of the expression than the one encountered. If such a rule is encountered, the original expression is replaced with the more specific form, and the outer expression containing the newly transformed expression is then evaluated in therms of the new form. Ultimately, each "run" of the kernel represents a traversal of a single composite expression. For example, if you tell it to evaluate an entire notebook, it evaluates a notebook expression, and thus, all of the sub-expressions in the notebook. When I say "transformation rules" I am speaking in more general terms than actual Rule[]s. -- "Philosophy is written in this grand book, The Universe. ... But the book cannot be understood unless one first learns to comprehend the language... in which it is written. It is written in the language of mathematics, ...; without which wanders about in a dark labyrinth." The Lion of Gaul

**References**:**Function, Command, Operator, Object...etc.***From:*"Steven T. Hatton" <hattons@globalsymmetry.com>