MathGroup Archive 2013

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

Search the Archive

Re: Mathematica and Lisp

On 1/12/2013 6:51 PM, David Bailey wrote:
> Mathematica has a vague resemblance to LISP, but there are big
> differences. One in particular, is that Mathematica lists are not linked
> lists.

David has a point:  to some extent Mathematica "does Lisp wrong".  Lisp
has lists but also arrays and hashtables.  Mathematica uses the term 
List, but the implementation is as an array. Then there is a SparseArray
which is also not an array but a hashtable.   The advantage of a true
list is that you can add new elements to it without copying it. The
advantage of an array is that you can access the nth element without
scanning through others.

Maybe it would be fairer to say that Mathematica "does data structures 
wrong"  because it conflicts with standard usage throughout computer

  That's one reason why I think it is questionable
that people should learn Mathematica's language as a first programming 
language.  (Another reason has to do with the terribly confusing 
implementation of scope in Blocks, Modules, Functions, Patterns.)
But that's not pertinent to this particular question.

There is another aspect though, suggesting learning Lisp is not a bad idea.
  which is that some parts of
Mathematica's underlying calculation engine are best accessed using
a functional programming style. These include Map and friends, Apply,
Function (&) and a handful of other constructs adapted and occasionally
corrupted from Lisp or other functional-style languages.

Learning a simple version of Lisp, namely Scheme,  by reading the
classic Structure and Interpretation of Computer Programs (SICP) by 
can be an illuminating, clarifying experience, especially for people who 
been exposed to any of the traditional languages or Mathematica.

If you have ever wondered if languages like C++ or Java or PHP ...
really need to be so complicated -- is it inherent in programming
algorithms?  then you should take a look at SICP. Free online.

> I'd read the Mathematica tutorial, and forget about LISP!

I'd recommend that you too read SICP. It's deceptively easy to get into,
and many people really enjoy it.


  • Prev by Date: Re: Aligning graphics on frame boundaries
  • Next by Date: Re: List:{1}, {2,3},{4,5,6}....
  • Previous by thread: Re: Mathematica and Lisp
  • Next by thread: Re: Mathematica and Lisp