7 ms·
I think you would appreciate the language better if you understood that it is just Lisp with a slightly different syntax. They do everything using symbols, and
by coliveira 12y ago
I think you would appreciate the language better if you understood that it is just Lisp with a slightly different syntax. They do everything using symbols, and all functions are decomposed into symbols for head and arguments. In my point of view, Wolfram language is a combination of many of the great concepts from Lisp and Prolog, which makes it very useful for knowledge representation.
- jordigh 12y agoIt's just about the only living mostly lisp implemented with mexps instead of sexps. But it sure is overhyped and it being proprietary is a huge drawback.
- lispm 12y agoLisp is not a rule-based term rewrite system.
- gertef 12y agoIt can be, if you define the appropriate macros
- lispm 12y ago'macros' don't buy you much in that case. you'll need a few functions, too. But that's not the point anyway - you can implement lots of things on top of Lisp. Lisp is based on a specific evaluation model. Not term rewriting. The way macros are computed is slightly related (since they take source and return source), but that's all.
- tokipin 12y agoMathematica has lisp essentially as a subset built on top of its rewrite system. In other words its rewrite system is so powerful that lisp can be naturally threaded into it. In particular the symbolic nature of the language means that everything is first class, functions and function constructions ("functional programming") and expressions in general ("macros") being just basic cases.
- gohrt 12y agoCan the user define a macro in Mathematica language?
- evanb 12y agoIt's not quite so clear as that. In Mma you can give special meanings to any patterns of symbols you like, which is very much like defining a macro.
- taliesinb 12y agoThere aren't read-time macros (yet). I'm actually in the process of designing a new package system that solves this (among many other problems).
- tokipin 12y agothe concept of "macros" in Mathematica doesn't really exist as its own concept because the whole system is based on rewriting structure. for example, the ReplaceAll function[1] which is commonly used in idiomatic code is basically an in-place macro definition and execution, yet it wouldn't occur to most people that it's anything special. if you're trying to make a traditional macro, you would implement it as a function with the HoldFirst et al attribute. an important thing to know is that ReplaceAll uses arbitrary structural patterns. it's not a simple "turn every a into b". you can say things like "turn every application of the symbol F on an even number into an application of G on that number divided by two". expr /. F[n_?EvenQ] :> G[n/2] [1] https://reference.wolfram.com/language/ref/ReplaceAll.html https://reference.wolfram.com/language/ref/ReplaceAll.html
- lispm 12y ago> Mathematica has lisp essentially as a subset built on top of its rewrite system. Right. > In other words its rewrite system is so powerful that lisp can be naturally threaded into it. a) lots of systems (turing machines, ...) can implement Lisp. b) it's not that natural in Mathematica. The natural part comes from its symbolic nature. But if you look at the documentation and read about how they implement lexical closures, it's all vague and not that pretty. The implementation actually needs to rewrite variable names, IIRC. I wonder why their documentation is so vague? They don't want independent implementations of their language?
- deleted 12y ago[deleted]