Re: something to chat about, lisp and Mathematica for list processing.



On Jun 23, 6:05 pm, Jon Harrop <j...@xxxxxxxxxxxxxxxxx> wrote:
rjf wrote:
I found that searching with google on mathematica macro got
557,000 hits...

Thinking about it some more, this is never going to work reliably because
macro is a homonym even in this specific context (e.g. C macro, Lisp macro
and OCaml macro all mean significantly different things).

I apologize to other readers for taking Jon's troll too seriously.

My objection was primarily to your statement that Lisp manipulates ASTs
whereas Mathematica manipulates text. I still don't think that statement
had any merit, although perhaps you were referring to Lisp's unconventional
lack of pretty printing and parsing of ASTs?

If so, you can rewrite programs using only FullForm in Mathematica, of
course...

--
Dr Jon D Harrop, Flying Frog Consultancy
The OCaml Journalhttp://www.ffconsultancy.com/products/ocaml_journal/?usenet

Sorry, again, Jon, (and readers too). I never said "Mathematica
manipulates text".

I said " In Mma, programs are viewed as fixed entities defined
solely by
explicit text (or notebooks) in files. "

In the most common situation, Mathematica's represents programs, once
they are read in from text files, as trees.
So does Lisp. Mathematica trees are built up of nodes of various
sizes, each of which is an array, mostly populated with pointers to
other arrays, symbols, constants. Lisp trees are built up of nodes of
fixed size, and atoms.

The fact is that Lisp macros are important tools for intermediate and
advanced Lisp programmers who use macros to facilitate the alteration
of the programs qua trees into other programs. It is used, for
example, to aid in abstraction, information hiding, building or
extending languages on top of Lisp, and other purposes, some not so
great (e.g. premature optimizations). I have not seen this done in
Mathematica. I can imagine people trying to do such things, by
defining programs by f[x_]= .... rather than f[x_]:= ..... But I
have not seen this. And even if it were done, it would not mean rules
are like macros.


You say
" although perhaps you were referring to Lisp's unconventional
lack of pretty printing and parsing of ASTs?"

I think you meant Lisp->Mathematica in that statement.

I have found Mathematica's on-line reformatting of program texts to
be less readable than my own formatting, which is too bad. In Lisp I
can depend on Lisp (or emacs) to reveal certain kinds of errors by
noticing anomalies in the automatic indentation. It seems to me that
Mathematica's support for the programmer, including debugging, has
been unsatisfactory for a long time. Rules make this hard, I suspect.

There is no reason to believe that a good "prettyprinter" cannot be
created for Mathematica. Maybe there is one already. It would not be
difficult to write one in Lisp, where there are packages to help do
this. The language is still overly complex both syntactically and
semantically, regardless of its formatting.




.



Relevant Pages

  • [OT] PostLisp, a language experiment
    ... IMHO the worst thing in Lisp is its many parentheses. ... The worst thing about Forth IMHO is the stack clutter. ... And while I could write a macro like (with bla ... The ret is the explicit return continuation. ...
    (comp.lang.lisp)
  • Re: Program compression
    ... problems to be solved much more concisely than with Lisp. ... In Common Lisp, it's another one line of code: ... My point is that different languages are based on different things ... it would be impossible for the author of a macro (in the Lisp ...
    (comp.programming)
  • Re: Why is LISP syntax superior?
    ... that lisp was the most powerful programming language ever invented, ... It is precisely the lack of syntax that I admire in Lisp ... (setf (elt seq i) ... I guess one could write a reader macro to transform foointo (elt ...
    (comp.lang.lisp)
  • Re: Python gets macros - now XML does too
    ... > I think the main advantage: You use Lisp within a Lisp macro to generate ... > generation part in another language than the description to generate the ... MetaL compiler flow module provides support for level 0 (macro ... Despite currently I only use PHP because I only develop Web ...
    (comp.lang.lisp)
  • Re: Using Japanese and English strings, encodings
    ... Usually, you can return from a macro a side-effect-free form, like ... NIL, and it will be ignored at the "call" site. ... Now, since you _imposed_ a usage pattern, the solution Common Lisp ... (:es "Desarrollo de aplicaciones y sistema UNIX.")) ...
    (comp.lang.lisp)