Re: something to chat about, lisp and Mathematica for list processing.
- From: rjf <fateman@xxxxxxxxx>
- Date: Sun, 17 Jun 2007 11:13:55 -0700
On Jun 16, 11:26 am, "Nasser Abbasi" <n...@xxxxxxxxx> wrote:
.......
And now I am using Mathematica more (for school work), and saw this in
Mathematica docs:
"Widely recognized as the world's most powerful list manipulation language,
Mathematica ..."
This is marketing fluff. It would be foolish to put any credence
into this statement.
Topic for discussion: From only the list processing/manipulation point of
view, and nothing else, what would you consider the advantages/disadvantages
of one over the other?
Lisp lists are linked lists. The List object in Mathematica appears
to be a fixed-length array or string.
Thus Mathematica is an array-based manipulation language and not even
in the same category.
Adding an element to the front of a list in Lisp is a constant-time
operation. Adding an element to
the front of a list in Mathematica takes time proportional to the
length of the "list" because it has
to be copied.
Advantages of Lisp involving list processing include several good
implementations (several free),
and excellent compilers. Mathematica is not free, and the "compiler"
last I looked worked only on
arithmetic, not lists.
Advantages of Mathematica include peculiar syntax which allows a
person skilled in its arcana to write compact,
yet unreadable code. Um, maybe not an advantage..
I am sure by now, any kind of list processing task that can be done by one
language, most likely can just as well be done in the other.
Actually, false. The data structure that corresponds to Mathematica
List would be
an array in lisp. So you could compare them. If you want to have a
lisp-like list
for (a b c d) in Mathematica, you could encode it as a[b[c[d[]]]]
and then they would
be similar. But none of the List operations or syntax built-in to
Mathematica would
work. And if you rewrote them, they probably be something like
10-1000 times slower than Lisp.
Anyone programming in lisp or mathematica should not have to count
matching parentheses
or square brackets, simply by using a text editor that flashes the
matching ( or [. Are there
any such programmers?
...I am thinking
more along the lines of a language design issues related to list processing
which might make one more suited for list processing than another.
To reiterate, Mathematica does not use a List data structure in the
computer science sense.
Many things that are said to be true about lists are false for
Mathematica Lists because
it is using arrays.
Lisp has macro expansion capabilities and there are advantages, for
the skilled programmer,
to make use of the fact that Lisp programs are lists and can be
constructed (e.g. by macro expansion)
and then compiled and run. Manipulating Mathematica programs is
presumably possible, but
I do not know of anyone doing so. As an indication that Mathematica
is relatively defective, note
that extensions to the system continue to be written, at least in
large part, in languages like C or C++.
While Lisp programs can be set up to call pre-existing libraries in C
or Fortran etc, it would be quite
unusual for a Lisp programmer to find an advantage to writing a large
new piece of code in C.
(I have used an occasional fragment of C to access a peculiar API ,
but the overall efficiency and
expressiveness of Lisp is not an issue the way it seems to be for
Mathematica).
May be someone here has more insight into both and educate us.
Nasser
PS. I just read the comments from DanL and he said some of the same
things.
RJF
.
- Follow-Ups:
- References:
- something to chat about, lisp and Mathematica for list processing.
- From: Nasser Abbasi
- something to chat about, lisp and Mathematica for list processing.
- Prev by Date: Re: Bug in Mathematica 6 - Integrate - 6 (Intermittent)
- Next by Date: Re: Bug in Mathematica 6 - Integrate - 8 (Log, Sin) - funny...
- Previous by thread: Re: something to chat about, lisp and Mathematica for list processing.
- Next by thread: Re: something to chat about, lisp and Mathematica for list processing.
- Index(es):
Relevant Pages
|
|