4 ms·
Care to explain your reasoning ? I thought this post was all about how Lisp meets that definition.
by tgflynn 16y ago
Care to explain your reasoning ?
I thought this post was all about how Lisp meets that definition.
- jules 16y agoWell Lisp doesn't meet this definition: > "a language in which the source code and the corresponding abstract parse tree have identical representations" As the representation of code is still strings in Lisp, but the AST cons cells.
- tgflynn 16y agoOK: s/identical representations/identical external representations/
- jules 16y agoWhat do you mean by external representations?
- tgflynn 16y agoBy external representation I mean a representation of code and/or data that the programmer can see and/or interact with. With current technologies this almost always means some form of serialized text (an exception would be LabView where programs are represented through an interactive graphical environment). An internal representation is a representation of code and/or data that is processed internally by a computer but is not directly visible to the programmer. Example: Internal representation: (defun fact (n) (case n (1 1) (otherwise (* n (fact (- n 1)))))) External representation: The set of linked cons cells that the above list gets parsed into by a Lisp interpreter.
- tgflynn 16y agoI reversed internal and external in the above comment and for some reason am unable to edit it.
- jules 16y agoYou can only edit posts for a certain amount of time. Doesn't the requirement for homoiconicity become vacuous then? The definition was: > "a language in which the source code and the corresponding abstract parse tree have identical representations" Now is: > "a language in which the source code and the corresponding abstract parse tree have identical external representations" Where external representation of source code is defined as the representation that's used in the interpreter or compiler, that is, the abstract parse tree. So the definition becomes: "a language in which the abstract parse tree has the same representation as the abstract parse tree"? Alternatively replace "external" by "internal" everywhere in this post, if "internal" is the right name for CONS cells.
- tgflynn 16y agoNo the reversal in my above comments only applied to the example, not the way I defined internal vs. external representations. Sorry for the confusion. My point is that you can't tell by looking at the defun in my above comment whether you're looking at Lisp source code or the parse tree (represented as a nested list) for that source code. The same would not be true in C where the external representation of the parse tree would be the C syntax for initializing some set of nested struct's. That would look very different than the source code itself.
- jules 16y agoAha, so homoiconicity == supports quoting. That seems like a reasonable definition, although it's not perfect I can't think of a better one.