Hacker News new | ask | show | jobs
by sah 6569 days ago
To make [case] work as a pure function, you would have to roll your own thunks by passing anonymous functions in for each case to be evaluated and each outcome. That works, but all that boilerplate becomes tedious.

I like Ruby's block syntax for doing this without macros, but unfortunately you only get to pass in one block per function.

1 comments

It's a worse-is-better thing: it makes some forms of abstraction awkward, you have to fool around chaining methods. But it does take the most common case and make it simple.

It seems like a legitimate design choice, even if I don't always like the resuls.