Smart Do

Matthias Berth matthias.berth at googlemail.com
Fri Nov 3 08:50:25 UTC 2006


how about calling it tuplesDo:, or partitionsDo:? How about this
comment "Evaluate aBlock for the receiver, consuming as many elements
at a time as the block has arguments".

By the way, ist there a method #partition: that takes a collection and
splits it into chunks of a given size?

Matthias

On 11/3/06, Francisco Garau <francisco.garau at gmail.com> wrote:
> The following version of do works in a slighltly smarter way. It's a more
> generic version of #pairsDo:
>
>  #( 1 2 3 ) smartDo: [:a | Transcript cr; show: a]
>  #( 1 1 2 2 3 3 ) smartDo: [:a :b | Transcript cr; show: a + b]
>  #( 1 1 1 2 2 2 3 3 3 ) smartDo: [:a :b :c | Transcript cr; show: a + b + c]
>
> I'm attaching a ChangeSet with the implementation. (Is this the best to
> contribute things? or should I package it in some other format?)
>
> Cheers,
> Francisco
> ---
> That which we call a rose by another name would smell as sweet -- WS
> ---
>
>
>
>
>
>
>



More information about the Squeak-dev mailing list