RE: Re: OOP in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg29156] RE: [mg29151] Re: OOP in Mathematica
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.de>
- Date: Fri, 1 Jun 2001 04:15:21 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
See below: > -----Original Message----- > From: John Doty [mailto:jpd at w-d.org] To: mathgroup at smc.vnet.net > Sent: Thursday, May 31, 2001 5:29 AM > To: mathgroup at smc.vnet.net > Subject: [mg29156] [mg29151] Re: OOP in Mathematica > > > In article <9f2g4c$878$1 at smc.vnet.net>, "Jens-Peer Kuska" > <kuska at informatik.uni-leipzig.de> wrote: > > > The head *is* the function call! > > No, the head is just the head. If a particular head is associated with > replacement rules that work like a function, you might want > to call that > head a "function". On the other hand, you can invert function > and argument > if you wish: > > In[33]:= x_[sin]^:=Sin[x] > > In[34]:= Pi[sin] > > Out[34]= 0 > > To be sure, most rules mimic function evaluation and/or > sequential flow of > control. This makes Mathematica look more like a "normal" programming > language than it really is. It's really just a convention: > Mathematica can > also define bizarre rules like the ones above. > > -- > | John Doty "You can't confuse me, that's my job." > | Home: jpd at w-d.org > | Work: jpd at space.mit.edu > John, you'r right: Mathematica is term-rewriting of a certain structure with head and elements, in Mathematica called expressions, until no further rule applies. Everything else is an illusion. Yet see, the evaluation sequence for expressions and Attributes (HoldAll, Orderless, etc...) are finely tuned to that "standard" illusion. To me it seems to be wise to stick to that metaphore, even for OOP with Mathematica. If you -- for a certain reason -- want to have, say Smalltalk "look and feel", then you might consider modifying the frontend for parsing the input. -- Hartmut Wolf