Logo

Programming-Idioms

Execute different procedures foo, bar, baz and barfl if the string str contains the name of the respective procedure. Do it in a way natural to the language.
New implementation

Type ahead, or select one

Explain stuff

To emphasize a name: _x → x

Please be fair if you are using someone's work

You agree to publish under the CC-BY-SA License

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
(some-> str {"foo" foo "bar" bar "baz" baz "barfl" barfl} (.call))

map is a function of a key, which return value for that key, if any.

There is case, but unlike map {} it is opaque, and you can't see which functions are whitelisted in runtime.

.call is a java.util.concurrent.Callable/call