Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: Mathematica and Lisp

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129895] Re: Mathematica and Lisp
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Sat, 23 Feb 2013 23:31:00 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <kcqkv4$lq5$1@smc.vnet.net> <kct7fj$sgo$1@smc.vnet.net> <kfkm72$j97$1@smc.vnet.net> <24729974.35095.1361092362942.JavaMail.root@m06> <kft1l8$cqr$1@smc.vnet.net> <kg71s0$4mo$1@smc.vnet.net> <kgab38$c7s$1@smc.vnet.net>

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 math-familiar 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/gallup-poll-americans-creationism-evolution_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 pre-typeset formulas into
expressions, in which case I might use an infix parser.

I have posted a program (in Lisp) which allows you to insert 
Mathematica-style 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 ...






  • Prev by Date: Re: ComplexExpand off by a factor of (-1)?
  • Next by Date: Re: Compiling numerical iterations
  • Previous by thread: Re: Mathematica and Lisp
  • Next by thread: Re: Mathematica and Lisp