Re: Lisp syntax vs. Mathematica syntax




Jon Harrop wrote:
> josephoswaldgg@xxxxxxxxxxx wrote:
> > My personal "favorite" is Apply, where I had not defined a function
> > "g". Check out Mathematica's documentation
> >
> > Apply[Plus, g[a,b]] --> a+b
> >
> > WTF! Hey, what happened to my function g? And, amazingly enough, at
> > least some folks at Wolfram think this is what Lisp does,
>
> Let's trying writing a Lisp macro equivalent to Mathematica's Apply.

You miss the point entirely. A wolf in sheep's clothing doesn't eat
grass.

Lisp has apply already, it is an ordinary function, and it takes as
arguments a function and a list (in the simplest case), and returns the
result of the function taking each element of the list as an argument.
It's extremely useful, and basic to the Lisp philosophy.

Mathematica has an "Apply" that specifies transformation rules that
take a symbol and an expression-tree and do surgery on the expression
tree to stick the symbol in. That ain't function application in my
dictionary. I'm guessing it doesn't get used much in Mathematica
applications, but was stuck in because someone had a fuzzy memory of
Lisp or Scheme, and thought it might be nice to have.

You seem not to distinguish between "functions" and "symbols
Mathematica uses to name functions, but also have various attributes
which determine their pattern-matching semantics." That is symptomatic
of your confusion between ordinary programming semantics,
pattern-matching, and Lisp macro manipulations. Until you learn to keep
them distinct, comparing Lisp, OCaml, and Mathematica will be very
confusing.

I've used Mathematica for a reasonable amount of work as well, but
"getting work done" in Mathematica is very different from "programming"
in Lisp. It has a totally different design philosophy.

.



Relevant Pages

  • Re: why do you choose LISP?
    ... i like lisp primarily bceause it is a functional lang. ... It is also during the early 1990s, i started to learn programing on my ... during these years i bought Mathematica (because i heard it's the ... I do not have any concrete idea what IS a language specification ...
    (comp.lang.lisp)
  • Re: Lisp and Scheme with fewer parentheses / Mathematica??
    ... Any dummy, at our level, knew that Mathematica and lisp have different ... programer, even with say 10 years of programing experience, chances ... functional language and one of the oldest language) ...
    (comp.lang.lisp)
  • Re: Lisp syntax vs. Mathematica syntax
    ... Let's trying writing a Lisp macro equivalent to Mathematica's Apply. ... In Mathematica, ... That's not what Lisp folks mean when they ... > What you are doing is not the same as other programming environments. ...
    (comp.lang.lisp)
  • Re: Benefits of Dynamic Typing
    ... Mathematica implements everything that you've listed from Lisp and adds ... > syntax for for representing data externally predefined ... Mathematica takes this further by allowing 2D typesetting of expressions. ...
    (comp.lang.functional)
  • Re: Whats so great about lisp?
    ... >>into some representation that happens to be exact in Lisp. ... >>tracks numerical errors in floating point arithmetic: ... The representation used by Mathematica tracks numerical error, ... > Does Mathematica have built-in condition system like Common Lisp? ...
    (comp.lang.lisp)