
Re: Mathematica and Lisp
Posted:
Jan 16, 2013 11:15 PM


On 1/15/2013 10:38 PM, John Doty wrote: > On Friday, January 11, 2013 8:23:16 PM UTC7, amzoti wrote: > >> It is clear the Mathematica uses Lisp as one of the example programming paradigms
it pulls from and I have a general question regarding this. > > Perhaps not as much as you think. Mathematica is fundamentally a term rewriting system,
a more general concept than the lambda calculus behind Lisp.
.... If you want a term rewriting system, several of them (free, open source) have been written in Lisp. Anything that Mathematica can do computationally can be done, in principle, with any "Turing equivalent" programming language, and that includes Lisp.
Lisp is not an implementation of the lambda calculus as some people seem to think. McCarthy used the word "lambda" the way Mathematica uses the word "Function". Other than that use to introduce formal parameters, nothing much was taken from Church's writings, as McCarthy has explained in some historical articles.
To be sure, the easiest thing to express as term rewriting
is the replacement of a function invocation by its body
(as in the lambda calculus), but Mathematica can do more
complex things, some rather strange from the lambda calculus point of view. Consider > > f_[whoCalled]^:=f > Sin[whoCalled]
Certainly such a feature could be implemented in a patternmatching system written in Lisp. Since most lisp implementations provide many "introspective" features including examining the runtime call stack, I think it would be possible to extract "who called me" from this information of the (complete) call stack. Lisp systems also tend to provide tools that answer questions like "where are all the calls to the function f in the source code.
> > which yields > > Sin > > Very alien to Lisp!
Not really.
>

