
Re: Mathematica and Lisp
Posted:
Feb 25, 2013 2:19 AM


On 24/02/2013 04:31, Richard Fateman wrote:
> 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). >
I think anyone with some Mathematica experience uses a selection of operators, such as /. etc. and spells out other things longhand. For example, I always write Map rather than use the /@ operator. On the other hand, I use the // operator a lot, so I was able to answer your test.
> > How do you know this? Do you have a survey? Just curious how you can say > this. Well, I have seen a fair bit of beginner Mathematica code, both from my consultancy and from answering questions on this forum. Practically nobody presents their code in full FullForm! For example, hardly anyone would spell out CompoundExpression rather than use a semicolon.
Suppose that FullForm were the only acceptable input to Mathematica  which you would appear to advocate. Would you want FullForm output also? That would result in some pretty ugly maths, so perhaps you would relent at this point, but part of the convenience of Mathematica is that you can paste bits of output back into other input!
Program bugs are often to be found in obscure bits of code that are hard to read. Formulae are obviously far easier to read if they are not written in FullForm (or Lisp!).
I would concede that it might be a good idea if certain built in symbols such as Sin had a new attribute such as NonAlgebraic that forbade their use in expressions like Sin Pi x.
The real truth is that conventional written maths is hopelessly ambiguous without context. That is why you can come up with expressions like Sin x  or indeed f(x). Likewise hardly any maths/physics paper would spell out those multiplications that were noncommutative (e.g. by using a special operator)  the reader is just meant to figure it out. Thus every CAS has to resolve those ambiguities one way or another. I'd say Stephen Wolfram's design is about as good as you can get  and certainly better than Lisp!
David Bailey http://www.dbaileyconsultancy.co.uk

