6 ms·
S-expressions are the most logical representation of data structures. “CAR”/“CDR” are not a part of the expression syntax, so this argument against them won’t m
by rhabarba 6y ago
S-expressions are the most logical representation of data structures. “CAR”/“CDR” are not a part of the expression syntax, so this argument against them won’t matter.
- tgb 6y agoI didn't read that as complaining about CAR/CDR, but rather it was making a joke: the section header is "Cons".
- rhabarba 6y agoAh. Too sophisticated...
- ben509 6y agoS-expressions are great once you've figured out functions, atoms, complex data types, etc. That's how Amazon's Ion[1] uses them: as a nice supplement to a serialization standard. > “CAR”/“CDR” are not a part of the expression syntax If you were implementing them for a serialization format, you'd leave out cons cells and car / cdr. But in late-binding LISPs, which is where they're typically used, (a . b) is part of the syntax. It's worth calling out for why you don't want it: it's badly typed since it could be a 2-tuple, or it could be a list depending on what 'b' is. [1]: https://amzn.github.io/ion-docs/docs/spec.html#sexp https://amzn.github.io/ion-docs/docs/spec.html#sexp
- fanf2 6y agoS-expressions lack a standard representation of maps/dictionaries. Even LISP is inconsistent: it has both alists (list of pairs) and plists (list of alternating keys and values). So S-expressions suffer a similar problem to XML: there is not a clear way to represent many data structures.