|
|
|
|
|
by Zambyte
970 days ago
|
|
Your core point is absolutely true about how Lisp is special in that it usually provides a read procedure to turn a textual type into a native object that can be evaluated (this is a side effect of homoiconicity, so any homoiconic language will have this property too), but I have one additional nitpick to make ontop of yours: > [...] eval can take any lisp object and evaluate it. eval cannot be generalized to accepting any Lisp object, only specifically symbolic expressions (symbols, or lists (potentially nested) of symbols). I discovered this because I thought Chibi Scheme was throwing a warning for valid code[0] to inject a value into an expression for eval, but Marc helped me understand that the warning was correct, because Scheme only specifies what eval does for symbolic values. [0] https://github.com/ashinn/chibi-scheme/issues/902 |
|
Anyways, here's CL's spec for eval[1]:
Form is defined in the glossary as "form n. 1. any object meant to be evaluated. 2. a symbol, a compound form, or a self-evaluating object."[2] And you can see this is an exhaustive categorization of lisp objects from the definition of self-evaluating object: "self-evaluating object n. an object that is neither a symbol nor a cons. If a self-evaluating object is evaluated, it yields itself as its only value."[3]IMO, the useful definition of homoiconicity is "the domain and codomain of eval are the same type". One of the "results" of eval might be that the evaluation routine signals error, if the object has a special evaluation rule.
EDIT: I just read that github thread more carefully, and I guess Scheme's eval is stricter and so, IMO, Scheme is less "homoiconic" :) FWIW, my experience is that Scheme pioneered a lot of things that are more similar to non-lisps than to the more lispy lisps: e.g. schemes typically seem to prefer batch-style compilation to REPLy environments. Source as files vs. image-based development and the standard defines the language in terms of text rather than datastructures.
[1] http://www.lispworks.com/documentation/HyperSpec/Body/f_eval...
[2] http://www.lispworks.com/documentation/HyperSpec/Body/26_glo...
[3] http://www.lispworks.com/documentation/HyperSpec/Body/26_glo...