MathGroup Archive 2005

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

Search the Archive

Re: Types in Mathematica

  • To: mathgroup at
  • Subject: [mg62265] Re: Types in Mathematica
  • From: John Doty <jpd at>
  • Date: Fri, 18 Nov 2005 05:57:53 -0500 (EST)
  • References: <> <> <dl8s4g$n41$> <dl980q$r2a$> <> <dlc96b$m81$> <dlhibt$5ki$>
  • Sender: owner-wri-mathgroup at

Steven T. Hatton wrote:
> Andrzej Kozlowski wrote:

>>Is Table a "variable in the sense of computer science"?
> It is an l-value.  And yes, in computer science a constant integer is a
> "variable".  Furthermore, I can modify Table by unprotecting it, and
> assigning to it.  


In[1]:= a := 1 /; b == 0

In[2]:= a := 0 /; b == 1

In[3]:= a

Out[3]= a

In[4]:= b = 0

Out[4]= 0

In[5]:= a

Out[5]= 1

In[6]:= a := 42

In[7]:= a

Out[7]= 1

In[8]:= b=.

In[9]:= a

Out[9]= 42

Never seen an l-value behave like a :-)

Mathematica doesn't have l-values. It has UpValues and DownValues, Set 
and SetDelayed, Pattern and Condition, etc. These things interact in 
marvelous ways uncontemplated in other languages.

 > Functions in Mathematica are not unlike functors in C++.

Functional programming is not really built into the Mathematica 
*language* at all: it is a matter of convention. For example:

In[10]:= x_[s] ^:= Sin[x]

In[11]:= Pi[s]

Out[11]= 0

Try defining an "argument" that operates on its "function" in any other 
language. Of course few Mathematica programmers would do anything this 
silly, and the Mathematica kernel contains many "built in functions" 
that conform to the functional convention. Nevertheless, you can go off 
the functional/procedural path in all sorts of interesting ways in 
Mathematica, and these ways really don't have close analogs in other 


  • Prev by Date: Re: DXF, OSG and Mathematica (OpenGL)
  • Next by Date: Lost connection to license server
  • Previous by thread: Re: Re: Types in Mathematica
  • Next by thread: Re: Re: Types in Mathematica