Skip to content

Instantly share code, notes, and snippets.

@leobm
Forked from zeroflag/chain.st
Created December 20, 2024 17:41
Show Gist options
  • Save leobm/e92b02c6487652adccb8bc8442336be0 to your computer and use it in GitHub Desktop.
Save leobm/e92b02c6487652adccb8bc8442336be0 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