In Smalltalk, you can “cascade” side-effectful calls to the same object using the semicolon (;) operator. E.g.:

If I understand it correctly, the semicolon is effectively a K-combinator or “Kestrel”.

I am jealous. Sure, we have Object#tap, but that’s awfully verbose by comparison:

(I’m using multiple taps in order to exactly mimic the semantics of the Smalltalk semicolon operator in the example above.)

Let’s see if we can do better for this simple case of cascading a series of commands, while ignoring their return values.

Yay! That looks a lot nicer.