       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:= a := 1 /; b == 0

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

In:= a

Out= a

In:= b = 0

Out= 0

In:= a

Out= 1

In:= a := 42

In:= a

Out= 1

In:= b=.

In:= a

Out= 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:= x_[s] ^:= Sin[x]

In:= Pi[s]

Out= 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

```

• 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