inject:into:

Bert Freudenberg bert at impara.de
Wed Nov 10 11:30:02 UTC 2004


Am 10.11.2004 um 09:50 schrieb Alexandre Bergel:

> Hi!
>
> I am wondering why the binaryBlock passed to an 'inject:into:' do not 
> bound the current element to the first argument. In some other words 
> why do we write:
>
> #(a b c) inject: '' into: [:partialAnswer :el| partialAnswer , el]
> and not:
> #(a b c) inject: '' into: [:el :partialAnswer| partialAnswer , el]
>
> It would more make sense, at least for me.

I think it was Dan explaining the "graphical" metaphor for remembering 
the order of arguments: Imagine the blocks are chained from left to 
right. The initial value enters at the left, the next element is fed 
from above, and each block's value leaves at the right going into the 
next block. The final value emerges on the right. So because the 
partial answer enters at the left it obviously is the first argument.

- Bert -




More information about the Squeak-dev mailing list