Re: Types in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg62265] Re: Types in Mathematica*From*: John Doty <jpd at whispertel.LoseTheH.net>*Date*: Fri, 18 Nov 2005 05:57:53 -0500 (EST)*References*: <200511120833.DAA19252@smc.vnet.net> <43762529.7060603@math.umass.edu> <dl8s4g$n41$1@smc.vnet.net> <dl980q$r2a$1@smc.vnet.net> <200511140805.DAA00041@smc.vnet.net> <dlc96b$m81$1@smc.vnet.net> <dlhibt$5ki$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

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. Hmm, 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 languages. -jpd

**Follow-Ups**:**Re: Re: Types in Mathematica***From:*Kristjan Kannike <kkannike@physic.ut.ee>

**References**:**Types in Mathematica***From:*"Steven T. Hatton" <hattons@globalsymmetry.com>

**Re: Types in Mathematica***From:*"Steven T. Hatton" <hattons@globalsymmetry.com>