Re: Function, Command, Operator, Object...etc.
- To: mathgroup at smc.vnet.net
- Subject: [mg61436] Re: Function, Command, Operator, Object...etc.
- From: albert <awnl at arcor.de>
- Date: Wed, 19 Oct 2005 02:16:15 -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 wonder if a pattern is an expression...
of course, why not? Everything is an expression (within mathematica). I
think this is somewhere in the documentation. Evaluate the following lines
to become a believer :-)
ToExpression["Pattern[x,Blank[]]"]
FullForm[x_]
Head[x___]
mypattern = x_
newpattern = mypattern /. Verbatim[x_] :> x___
{newpattern}
MatchQ[{}, {newpattern}]
MatchQ[{1,2,3},{newpattern}:>Hold[x]]
albert
- References:
- Function, Command, Operator, Object...etc.
- From: "Steven T. Hatton" <hattons@globalsymmetry.com>
- Function, Command, Operator, Object...etc.