3 ms·
Isn't Mathematica very Lispy? It looks like R-expressions.
by TazeTSchnitzel 11y ago
Isn't Mathematica very Lispy? It looks like R-expressions.
- carlob 11y agoWell M-expressions to be more precise. Actually if you ask some they'll tell you that Mathematica is the only Lisp that implemented them.
- ska 11y agoOr M-LISP. Or Logo for that matter (loosely).
- carlob 11y agoYeah, I don't really believe the claim that it's the only one, it's probably fair to say it's the most widely used though.
- ben11kehoe 11y agoAnd with good cause, I think. Mathematica syntax (both the verbose form and with the various syntactical sugar) is immensely more readable to the average person than Lisp. Of course, this could have been done on top of Lisp anyways (and wouldn't that be nice?)
- lispm 11y agoSurprise, Macsyma, which is written in Lisp has that syntax. Macsyma is the earlier computer algebra system, which Kent Pitman mentioned in that post. He also mentions that Wolfram knew Macsyma. Example: applysymmetry(exp,opdum,symtype):=block( [getdum:get(opdum,symtype),piece,inflag:true,partswitch:true], if getdum=false then return(exp), subst(lambda([[arglist]], apply('aplsym1,append(getdum,[arglist,opdum]))), opdum,exp))$ If you know Lisp, you will recognize typical constructs like IF, RETURN, SUBST, LAMBDA, APPLY, APPEND, ...
- ska 11y agoAnd this is an entirely normal usage of lisp: define a domain specific language (DSL) on top of the lisp, to manipulate the natural objects of the domain in a natural way. I've always thought Mathematica would have been a better system build on top of a "real" lisp, and would have got there faster. I've never heard any of Wolframs statements about the parallels that have made me question that, but I could be missing something.
- ben11kehoe 11y agoThis still seems more limited than the Mathematica syntax, which includes postfix operators, for example. I also appreciate that parentheses are used only for grouping, not for function calling and such. I'm not saying this couldn't have been done with Macsyma or on top of Lisp more generally (indeed, that would be nice), or that Mathematica wasn't influenced by Macsyma; I'm saying that purely for syntax, I think Mathematica ended up with a better, more extensive, and easier-to-use system than pretty much any other language.
- lispm 11y agoMacsyma also has postfix operators.
- TazeTSchnitzel 11y ago> Well M-expressions to be more precise. M-expressions is what I meant, I think I misremembered the name.
- fanf2 11y agoDylan is a lisp with readable syntax.
- phs2501 11y agoThe syntax looks a lot like M-expressions, but the evaluator is about as far from a normal Lisp as you can get. Mathematica uses a fixed-point evaluator; that is, expressions continue evaluating until they reach some stable state. Every common Lisp I've seen will only evaluate once unless you explicitly code for it. While this evaluation behavior is very useful for mathematics, I find that it makes Mathematica a poor general-purpose programming language. It's pretty easy to wind up with confusing evaluation behavior, and controlling evaluation in Mathematica is a very complicated topic. There are myriad language constructs used to do so: Unevaluated, Hold, HoldForm, HoldAllComplete, other Hold*; see http://stackoverflow.com/questions/1616592/mathematica-unevaluated-vs-defer-vs-hold-vs-holdform-vs-holdallcomplete-vs-etc http://stackoverflow.com/questions/1616592/mathematica-uneva... and http://library.wolfram.com/infocenter/Conferences/377/ http://library.wolfram.com/infocenter/Conferences/377/ for more information.