[squeak-dev] The Trunk: Collections-ct.982.mcz

Tobias Pape Das.Linux at gmx.de
Sun Jan 30 14:09:41 UTC 2022



> On 30. Jan 2022, at 14:56, Levente Uzonyi <leves at caesar.elte.hu> wrote:
> 
> Hi Christoph,
> 
> I just had the idea to use a proxy that converts cascades to chained message sends to support your use case.
> The following snippet
> 
> ((((((1 to: 100) asArray reversed
> 	collect: [ :each | each squared + 1 ])
> 	select: #even)
> 	collect: [ :each | each // 2 ])
> 	select: [ :each | each \\ 7 = 1 ])
> 	first: 5)
> 	sorted
> 
> can be written as
> 
> (1 to: 100) wrap: [ :wrapper |
> 	wrapper
> 		asArray;
> 		reversed;
> 		collect: [ :each | each squared + 1 ];
> 		select: #even;
> 		collect: [ :each | each // 2 ];
> 		select: [ :each | each \\ 7 = 1 ];
> 		first: 5;
> 		sorted ]
> 
> I attached the change set in case you're interested.

That's just HOM with additional hops, right? ;D
-t


More information about the Squeak-dev mailing list