MathGroup Archive 2005

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

Search the Archive

Re: Types in Mathematica

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:



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

Dr Jon D Harrop, Flying Frog Consultancy Ltd.

  • 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