23 ms·
It's kinda perfect. Sexps are readable, very easily and quickly navigable and mobile (i.e. moving some expression(s) around in the program source) w/ something
by gkya 9y ago
It's kinda perfect. Sexps are readable, very easily and quickly navigable and mobile (i.e. moving some expression(s) around in the program source) w/ something like paredit, very easy to partially evaluate, parse, and they are easy to write. The complexity of the program is almost entirely contained within the tree of function calls instead of partly in the syntactic representations of the operations and literals. It's very easy to teach: we have lists, they contain symbols (i.e. names), numbers, strings (i.e. text), and other lists; symbols stand for themselves when quoted, or treated as variable names if not and evaluate to the values they name; if we don't quote the lists, they are function calls, the initial item must then be a name of a function, and the rest are arguments to that function. The entire program is made up of function calls, some evaluated at compile time, some run time. That is a fairly complete definition of a Scheme and CL like syntax. Furthermore, I find the Polish notation way of writing down mathematical expressions (albeit I seldom use them) as sexps is superior to the infix notation because any possibility of ambiguity is effortlessly dealt with. Basically there's no reason to further complicate a simple and useful thing when the complexity added does not offer substantial benefits while keeping those that the simpler solution offers.
- viperscape 9y ago> any possibility of ambiguity is effortlessly dealt with "(+ 1)" is rather ambiguous and evaluates to 1, compared to "1 + ", which is very straight forward-- it's an incomplete expression and no evaluation can be done.
- taeric 9y agoI'm curious how it is ambiguous. What two meanings do you see?
- xapata 9y agoPerhaps the complaint is that there's a sort of cold-start problem -- it's not obvious that we're starting from zero. With addition, it's hard to imagine what else to start from, but perhaps starting from 1 would make sense in some contexts, where `(+ 1)` could evaluate to `2`.
- dragonwriter 9y agoThe use of + as shorthand for sum (Σ would be clearer, but alas, not ASCII) is perhaps not ideal, but that's not an S-expression problem, but a function naming problem.
- gkya 9y agoIn addition/summation the base case is zero. And I find it quite apt that the plus operator stand for summation in a language where operator precedence is not a debate.