Skip to content

Instantly share code, notes, and snippets.

@fogus
Forked from zeroflag/chain.st
Created March 30, 2022 16:39
Show Gist options
  • Save fogus/2a8a189e641137a826bfd115e3200afb to your computer and use it in GitHub Desktop.
Save fogus/2a8a189e641137a826bfd115e3200afb to your computer and use it in GitHub Desktop.
Object>>chain
^ ChainProxy new setTarget: self
ChainProxy>>doesNotUnderstand: aMessage
target := aMessage sendTo: target.
^ target
ChainProxy>>setTarget: anObject
target := anObject.
^ self
"Example"
#(apple peach banana) chain
groupedBy: #size;
select: [:each | each size even];
values;
collect: #asCommaString.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment