2 ms·
That's sort of the point. It's "just Python". It's s-expression syntax for Python. Why would one want such a thing? Well, s-expressions confer many advantages
by dTal 7y ago
That's sort of the point. It's "just Python". It's s-expression syntax for Python.
Why would one want such a thing? Well, s-expressions confer many advantages (and of course, some disadvantages - it's good to have a choice!)
- It makes it easy to write code that writes code, which is useful because it affords "compile-time" abstractions with no runtime performance penalty (in lisp terms, "macros").
- If you're comfortable with a structure editor, it enormously lowers the friction involved in refactoring.
- It allows everything to be an expression:
json.loads(with f as open("file.json"): f.read()) #doesn't work
(json.loads (with [f (open "file.json")] (f.read))) ;works
- It effectively removes all restrictions based around things fitting on a single line - lambdas are the canonical example.