3 ms·
For someone who hasn't used sexprs or looked at an AST before, it might not be clear why a data structure and atomic elements are goals in the first place. I t
by Reelin 6y ago
For someone who hasn't used sexprs or looked at an AST before, it might not be clear why a data structure and atomic elements are goals in the first place.
I tried to write an explanation but found it surprisingly difficult to articulate. In short, there's almost certainly other ways to accomplish the same thing but sexprs are dead simple and they work _really_ well in practice. Just go use them and it will make sense!
- username90 6y agoSexpr makes expressions easier for computers to parse. That is all there is to it. Other languages focuses more on making code easier for humans to parse. Both are good for different things.
- chriswarbo 6y agoLisp and s-expressions are two different things. In particular, there are various alternative syntaces for Lisp, which we can automatically convert between (e.g. via a pre-processor, or a reader macro), e.g https://readable.sourceforge.io https://readable.sourceforge.io https://www.dwheeler.com/readable/sweet-expressions.html https://www.dwheeler.com/readable/sweet-expressions.html https://srfi.schemers.org/srfi-49/srfi-49.html https://srfi.schemers.org/srfi-49/srfi-49.html https://srfi.schemers.org/srfi-119/srfi-119.html https://srfi.schemers.org/srfi-119/srfi-119.html
- minerjoe 6y agoBut your editor is also a "computer". Editing lisp code with an editor tuned to s-expressions can be pure joy. Most programmers work at the character level of text files, many lispers work much closer to the abstract syntaxt tree (AST).
- Reelin 6y ago> Sexpr makes expressions easier for computers to parse. That is all there is to it. I would _strenuously_ disagree with that claim, but as previously stated I find the explanation of why I disagree to be surprisingly difficult to articulate. Nonetheless, I find that in practice sexprs are an incredibly effective tool for the task of programming as a whole.