
Re: Mathematica and Lisp
Posted:
Feb 23, 2013 11:31 PM


On 2/23/2013 4:01 AM, David Bailey wrote: > On 22/02/2013 06:05, Richard Fateman wrote: >> >> Anyway, getting back to Mathematica and Lisp... >> Since Lisp programs tend to be short, there are fewer opportunities >> for bugs. Mathematica programs can be short too, but the irregular >> syntax makes them harder to read. See djmpark's comment about FullForm >> below. Lisp is like FullForm all the time. >> > > Yes Lisp is rather like FullForm  but who in their right mind would > write all their Mathematica code in FullForm! > > The beauty of FullForm, is that you can render an expression into this > form to resolve any misconceptions you may have about operator > precedences etc. > It means that for many people the misconceptions that they have about precedences are never revealed to them because they don't use FullForm, and their programs are buggy. There are hosts of arbitrary precedences among // /. /; _ _? .... that ordinary mathematics does not have, so the ordinary mathfamiliar occasional programmer has no solid clue. For example, do you know offhand if Pi x // Sin is Sin[Pi*x] or Pi*Sin[x] ? Do you realize that if you type Sin Pi x you see as a result, Pi Sin x. so it seems that Mathematica believes sin(pi*x) = pi*sin(x).
> Since practically nobody writes all their Mathematica code in FullForm, > it follows, does it not, that they must find Mathematica code > significantly (I would say massively) more readable than Lisp!
How do you know this? Do you have a survey? Just curious how you can say this. Making up statistics is easy. Even with poll data it is sometimes hard to draw conclusions. For example,
46% of Americans belief that God created humans in their present form within the last 10,000 years.
http://www.huffingtonpost.com/2012/06/01/galluppollamericanscreationismevolution_n_1563800.html
............
Actually, the occasional preference for infix arithmetic in the midst of lisp code can be satisfied by any of a number of packages, some dating back to the 1960s. More recent code can be found in e.g. http://www.cs.berkeley.edu/~russell/code/logic/algorithms/infix.lisp which allows you to write "x+y*z" instead of (+ x (* y z)).
I find that most of my programs are much heavier on control logic than on arithmetic. Occasionally I have to convert pretypeset formulas into expressions, in which case I might use an infix parser.
I have posted a program (in Lisp) which allows you to insert Mathematicastyle arithmetic expressions into Lisp, e.g. (+ x (mma "z * Pi x//Sin").
So if you think Mathematica is more readable, you can use it for mathematical expressions inside Lisp.
Other advantages, like open source free multiple suppliers ANSI Standard debuggers libraries compilers ...

