5 ms·
Incidentally, this is why prefix notation seems so foreign. (+ 1 2) reads as "plus one two." It might just be the Lisp version of Stockholm Syndrome, but it se
by iak8god 11y ago
Incidentally, this is why prefix notation seems so foreign. (+ 1 2) reads as "plus one two."
It might just be the Lisp version of Stockholm Syndrome, but it seems perfectly natural to me to gloss that as "Add one and two."
- sillysaurus3 11y agoGood point. (eq (+ 1 2) 3) would read "is add one to two equal to three?" though.
- Retra 11y ago"Are the sum of one and two equal to three" is how you'd read that.
- jjnoakes 11y agoEqual would come first for lisp. "Would you consider equal the sum of 1 and 2 to 3?"
- sillysaurus3 11y agoLisp is read from the middle. (+ 1 2) sort of comes first since it's evaluated first. Though now that I type that out, I'm acutely aware of how strange it sounds. Interesting. It's also not true in the case of macros, e.g. let. So, you're right. No wonder it seems so foreign.
- lispm 11y agoDon't use EQ to compare numbers. Use EQL or = . EQ is object sameness. Number objects of the same value are not necessarily the same object.
- noblethrasher 11y agoOne thing that long ago helped me to apprehend and appreciate the power of functional programming was to start thinking descriptively (in terms of facts and propositions) rather than prescriptively (in terms of imperatives and commands). Thus, I read “(+ 1 2)“ as “the sum of 1 and 2” rather than ”add 1 and 2“. Similarly, I read ”(eq (+ 1 2) 3)“ as ”the difference between 3 and the sum of 1 and 2 is zero“.
- ajuc 11y ago"Equality of (sum of 1 and 2) and 3". It's nice because it shows it's a value not a question. But I don't really verbalize code, I think in symbols, maybe that's why prefix doesn't bother me.