Re: Types in Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg62878] Re: Types in Mathematica
• From: Jon Harrop <usenet at jdh30.plus.com>
• Date: Tue, 6 Dec 2005 23:12:18 -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> <dlkc76\$pq0\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```John Doty wrote:
> 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.

In OCaml, that could be written:

let rewrite = function
Apply(x, [Symbol "s"]) -> Apply(Sin, [x])

The difference is only that the underlying representation of an expression
is exposed:

f[x]

is:

Apply(Symbol "f", [Symbol "x"])

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html

```

• Prev by Date: Re: Types in Mathematica, a practical example
• Next by Date: Re: Types in Mathematica thread
• Previous by thread: Re: Types in Mathematica
• Next by thread: Re: Types in Mathematica