MathGroup Archive 2001

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

Search the Archive

Re: Re: OOP in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29163] Re: [mg29151] Re: OOP in Mathematica
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Fri, 1 Jun 2001 04:15:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

This is true, but is not the whole truth. Mathematica has both genuine
functions and symbols with re-write rules attached to them ( DownValues,
UpValues and Subvalues)  which can be said to mimic functions. The "genuine"
functions are the built in functions, like Sin, and pure functions like
#^2&. In the case of these functions it is indeed true that the "head is the
function call", except that the function call may not take place if a
re-write rule prevents it, e.g.

In[2]:=
g_[x]^= 1;

In[3]:=
#^2&[x]
Out[3]=
1

-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/~andrzej/


on 01.5.31 0:28 PM, John Doty at jpd at w-d.org wrote:

> 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.




  • Prev by Date: Re: Mathematica magazine formatting
  • Next by Date: RE: Re: OOP in Mathematica
  • Previous by thread: Re: Mathematica magazine formatting
  • Next by thread: RE: Re: OOP in Mathematica