Skip to content

Instantly share code, notes, and snippets.

@zeroflag
Created November 20, 2021 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zeroflag/1634116227c3b811f0692db4f2889634 to your computer and use it in GitHub Desktop.
Save zeroflag/1634116227c3b811f0692db4f2889634 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