4 ms·
I can't imagine someone who has ever written a Lisp macro coming away thinking "there's nothing special about s-expressions". Honestly, sounds like you're comme
by brabel 3y ago
I can't imagine someone who has ever written a Lisp macro coming away thinking "there's nothing special about s-expressions". Honestly, sounds like you're commenting on something you have absolutely no knowledge of.
- eru 3y agoGreat ad hominem! I have used Scheme, Racket and Common Lisp (SBCL) since the 1990s (before mostly switching to the ML family of languages). I read 'On Lisp' cover to cover. I know what I am talking about. You can still disagree with me, of course. But don't do it of the basis of me not having used enough Lisp. S-Expressions make it easier to write macros that blend seamlessly into the host language. But there's no magic to them (compared to macros you could do as pre-processing in any other language) beyond that. S-Expressions are a neat syntax. But homoiconicity is a weird concept; if it is coherent at all, it only pertains to the surface syntax level of the language.
- lisper 3y ago> I know what I am talking about. Sorry, but you manifestly don't: > there's no magic to them (compared to macros you could do as pre-processing in any other language) The "magic" of s-expressions is that they make it easy to operate on the source code of a program as a hierarchical data structure (i.e. as an AST) rather than as text. That turns out to be an extremely powerful lever. It is is one of the reasons Lisp has lasted as long and been as influential as it has. I'm sorry if this sounds like an ad-hominem, but if you think there is "no magic" to S-expressions the most likely explanation is that you don't really understand them. There is nothing comparable in any other language. There's a reason that they are still in use today. Indeed, there is a reason that they keep getting re-invented again and again. HTML, XML, and JSON are all (badly) reinvented s-expressions. > homoiconicity is a weird concept No, it isn't. It is simple and straightforward: homoiconicity is where the primary representation of programs is a data structure in a primitive type of the language itself. It isn't any weirder than (say) recursion. If you think it's weird that is more evidence that you don't actually understand it.
- mathisfun123 3y ago>The "magic" of s-expressions is that they make it easy to operate on the source code of a program as a hierarchical data structure where exactly is the magic? it's just tuple unpacking? like congrats you've constrained yourself to the absolute bare minimum and you've made it work. i mean i guess congrats for getting it to work at all but it's not magical, it's tedious. if you showed me a homoiconic language that did somehow pull off the magic trick of being more expressive than tuples then i would be indeed enchanted (mathematica at least manages to put lipstick on the whole exercise).
- distcs 3y ago> i mean i guess congrats for getting it to work at all but it's not magical, it's tedious. Magic lies in the eyes of the beholder. So you may not find it magical while I do. But I don't understand how you say that it is tedious. With the homoiconicity of Lisp, you use the Lisp language itself to write macros and you manipulate the lists that make your Lisp programs directly. Mainstream languages these days either need you to learn a special syntax for macros or they need you to learn their AST structures/classes and manipulate them or sometimes both. Isn't this more tedious? Isn't the Lisp way simpler and less tedious?
- lisper 3y ago> where exactly is the magic? There is a reason I put the word "magic" in scare quotes. > it's just tuple unpacking? It's not even that. S-expressions are just a serialization of linked lists. The "magic" happens because the details of the serialization happen to make them particularly good for writing code. See my reply to /u/eru for more details. https://news.ycombinator.com/item?id=36599470 https://news.ycombinator.com/item?id=36599470
- eru 3y ago> It's not even that. S-expressions are just a serialization of linked lists. Well, it's more like serialization of a binary tree. Cons-cells can branch in both the car and the cdr direction.