3 ms·
The code-as-data paradigm in Lisp means that you can write your own eval. Eval was an important historical discovery, because of the fact that it could be writt
by lmkg 15y ago
The code-as-data paradigm in Lisp means that you can write your own eval. Eval was an important historical discovery, because of the fact that it could be written in Lisp itself. In fact, a minimal eval is rather easy: Recurse down nested linked lists, switching on the first element to handle special forms, and recursively evaluating functions and arguments.
Eval is basically a DSL, which happens to be the same as the host language. Part of the awesomeness of Lisp is that you can write your own DSLs. Sometimes that involves macros, sometimes that involves a home-brew eval function. But either way, the full-blown eval has very few use cases.