3 ms·
> 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 j
by 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.
- lisper 3y agoThe distinction between a linked list and a binary tree is in the eye of the beholder. One of the brilliant things about s-expression syntax is that (a b c) is equivalent to (a . (b . (c . nil)))) so there is no distinction between binary trees and linked lists (whose elements can be other linked lists) other than that to be a "proper" list it has to be null-terminated.