|
|
|
|
|
by lispm
2553 days ago
|
|
> One strange Lisp variant is Mathematica I wouldn't call Mathematica a Lisp, given that it is a runtime rewrite system and not based on a defined evaluator (which also makes Lisp relatively easy to compile and also compilable to relatively efficient code). > That way you could define both a macro and function version of a symbol if they both make sense. There is a variant of that in CL called 'compiler macro'. > The utility of two namespaces seems to be than when Lisps were dynamically scoped One still has the same problems with global symbols in Scheme. (define (foo list) (list list))
Here the parameter variable LIST shadows the global function LIST. |
|
It's derived from Wolfram's conception of Macsyma, and it is designed so that all code is made out of numbers, strings, symbols, and arrays (sure, not cons cells). I guess it's nice to know you wouldn't call Mathematica a Lisp, but I didn't say it was strictly in the Lisp family, just a strange variant. (Does this mean you do not consider PicoLisp a Lisp either, since it is not really compilable, as far as I can see? Or is it fine to you because it has a defined evaluator?)
Mathematica does have a built-in compiler, but granted it is unclear exactly what subset of the language it is compiling.
> There is a variant of that in CL called 'compiler macro'.
I am aware, but that certainly does not have the same effect because CL is not required to invoke your compiler macro. This means you cannot rely on compiler macros for control flow manipulations, like what 'and' requires. (I know you said "variant," but they are more of an optimization than what I was talking about.)
> (define (foo list) (list list))
As I said, with lexical scoping "this became a bit less of an issue." What I had in mind is that at least any of these kinds of shadowing errors will be entirely local. You won't have the problem that by using 'list' as the name of an argument, if it were dynamically bound in a Lisp-1 it would mess up any function you might call that itself uses 'list'. Lexical scoping at least prevents this spooky action at a distance that you would need a Lisp-2 to prevent under dynamic scoping.