tag:blogger.com,1999:blog-6454006.post1669569072745570288..comments2024-01-16T14:32:49.175+00:00Comments on Arcane Sentiment: It's not homoiconicityArcane Sentimenthttp://www.blogger.com/profile/04144052171693893368noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6454006.post-73038846812857908512010-12-11T15:51:25.798+00:002010-12-11T15:51:25.798+00:00What many people fail to understand is that homoic...What many people fail to understand is that homoiconicity isn't about manipulating <i>code</i>, per se, but rather manipulating the <i>syntax</i>. The difference here is that code is typically thought of as a stream of characters (i.e., a string), whereas syntax is a higher level. The reason that Lisps are homoiconic is because the code, by nesting s-expressions, mirrors the abstract syntax tree of the program. In many other languages, you need to both scan and parse the code to form a syntax tree, but in Lisps you can get away with just scanning, since the program is already represented as a tree.<br /><br />If the language's <i>syntax</i> is represented as a sequence of characters, and the language has a string type to manipulate strings, then it'd be homoiconic.<br /><br />Languages like C and Perl can operate on strings, but the strings themselves don't represent the syntax of the program. They'd have to be parsed first, and that's why they're not homoiconic.<br /><br />In short, Lisps are said to be homoiconic because their programs are represented as a syntax tree and Lisps feature those trees as a datatype.Anonymoushttps://www.blogger.com/profile/15233035268985201109noreply@blogger.comtag:blogger.com,1999:blog-6454006.post-55963317482066213182010-02-07T11:57:12.102+00:002010-02-07T11:57:12.102+00:00Or, you know, you could use the same source that y...Or, you know, you could use the same source that you'd have to look up S-expressions, metaprogramming, and abstract structure in to look up homoiconicity...Sean B. Palmerhttp://inamidst.com/sbp/noreply@blogger.comtag:blogger.com,1999:blog-6454006.post-20679139979052326922009-05-25T14:26:16.527+00:002009-05-25T14:26:16.527+00:00"I think there could be better alternatives to S-e..."I think there could be better alternatives to S-expressions that preserve their all-important convenience."<br /><br />That's why I don't think ignoring object orientation as a 'special case of closures' is a good idea. Because the answer is literally staring them in the face: make the syntax type a <I>subclass</I> of s expressions. Let it carry more information, but let car, cdr, cons, list, quasiquote, etc. all work with it as transparently as they do with normal lists!Anonymousnoreply@blogger.com