Dec. 1, 2015
10:29 a.m.
2015-12-01 10:29 GMT+01:00 Nicolai Hess <nicolaihess@gmail.com>:
2015-12-01 10:26 GMT+01:00 Sven Van Caekenberghe <sven@stfx.eu>:
On 01 Dec 2015, at 10:24, Thierry Goubier <thierry.goubier@gmail.com> wrote:
Note that the sum with #anyOne is wrong.
#(1 2 3 4 5) inject: #(1 2 3 4 5) anyOne into: [ :sum :each | sum + each ]
returns 16 instead of 15.
You have subtract the element you picked with #anyOne !
I think he means the suggested implementation for newSum is wrong, just because of this reason.
Exactly ;)
Thierry