Hacker News new | ask | show | jobs
by dalke 3615 days ago
+ is an associative binary operator. You have to decide which pair to add first.
1 comments

To add on, I think he's writing from a Lisp perspective, not general math notation.
That doesn't matter. It's just the basic associative property of addition in arithmetic. As such, it's present in all programming languages.
But in normal math it's easy to use n-ary addition.
In Lisp too -- arguably easier than in most languages. To add 10+9+8 in Lisp you write (+ 10 9 8), a single 3-ary call to +. In, say, C you write 10+9+8 and the parser turns that into two 2-ary additions.

(Of course, in either language you end up with two 2-operand ADD instructions in the object code. Nothing has hardware for arbitrary n-ary adds!)

Nowadays math mostly ends up in a CPU crunching two inputs at a time.

If you don't write it so explicitly, a compiler will do it for you anyway.

Thank you both, that makes sense.