Re:Why does Haskell, in your opinion, suck?
by sillysaurus3 on Sunday April 17, 2016 @11:48AM
(#11514931)
Good point. (eq (+ 1 2) 3) would read "is add one to two equal to three?" though.
[ Parent
| on HN ]
Re:Why does Haskell, in your opinion, suck?
by noblethrasher on Sunday April 17, 2016 @08:06PM
(#11516951)
One 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“.
"Are the sum of one and two equal to three" is how you'd read that.
Re:Why does Haskell, in your opinion, suck?
by jjnoakes on Sunday April 17, 2016 @01:36PM
(#11515391)
Equal would come first for lisp.
"Would you consider equal the sum of 1 and 2 to 3?"
Re:Why does Haskell, in your opinion, suck?
by sillysaurus3 on Sunday April 17, 2016 @01:41PM
(#11515416)
Lisp 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.
Don'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.
"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.