Hacker News new | ask | show | jobs
by viperscape 3060 days 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.

3 comments

The 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.
I'm curious how it is ambiguous. What two meanings do you see?
Perhaps 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`.
In 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.