Re: Lisp syntax vs. Mathematica syntax



josephoswaldgg@xxxxxxxxxxx wrote:
> Mathematica takes a TOTALLY different approach to programming
> abstraction. And I'd hardly consider the resulting dog's breakfast as
> "no problem."

You can write a term-level interpreter for Mathematica just as you can write
an interpreter for any other language. You can write programs in
Mathematica as you would in other languages. It is, after all, evaluated in
basically the same way.

> Look how much punctuation Mathematica introduces to keep "infix"
> notation going.
> ...

Just to clarify, many of the symbols that you've listed are simply infix
functions. You've also omitted a lot of Mathematica's syntax (which is
unusually complicated).

Mathematica can also be very concise. For example, the following squares
each element in a list "l":

#^2&/@l

The OCaml equivalent is:

List.map (fun x -> x*x) l

The C++ equivalent is:

int sqr(int x) { return x*x; }
transform(l.begin(), l.end(), l.begin(), sqr);

OCaml's grammar contains much of the complexity but also a great deal more
(such as the typing of polymorphic variants). To put things in perspective,
my (incomplete) Mathematica grammar was 200LOC and OCaml's grammer is
1,500LOC.

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com
.



Relevant Pages

  • Re: A(n orthogonal) set of essential operations for CAS
    ... > doing the kinds of things Mathematica is used for. ... Programming symbolic computation in C++ or Java ... > languages and CAS programs. ...
    (sci.math.symbolic)
  • Re: Survey: What led you to functional programming?
    ... Interesting to see that Mathematica has had such a large influence... ... Stephen Wolfram is now a billionaire ... During this time, I mostly neglected programming, so when I finally ... becoming a translator pursuing programming language theory research ...
    (comp.lang.functional)
  • Re: Very poor Lisp performance / about Mathematica
    ... Would you say that the Fibonacci recurrence relation is a recursive mapping ... The Fibonacci function (in the programming language sense) as a pattern ... just not in the mathematical sense? ... >> I wouldn't apply any of that theory to Mathematica directly. ...
    (comp.lang.lisp)
  • Re: Lisp syntax vs. Mathematica syntax
    ... > You can write a term-level interpreter for Mathematica just as you can write ... You can also write a Mathematica-like syntax parser in Lisp. ... talk about functional programming. ...
    (comp.lang.lisp)
  • Re: A question on Newtons Method
    ... >> Fortran 95 is a good language to learn the imperative ... >> style of programming for numerical work, ... >> functional programming thrown in. ... How many times have you seen Mathematica ...
    (sci.math.num-analysis)