Follow

The juxt function is one of my favorites. It returns a function that lets you run many functions against the same parameters and returns the results as a vector.

((juxt inc dec even? odd? -) 1)
=> [2 0 false true -1]

clojuredocs.org/clojure.core/j

@tomheyes

How about

((apply juxt [:foo :baz]) {:foo 2 :bar 3 :baz 4}
=> [2 4]

A really nice way to extract values from a map, especially nice if one is operating on a sequence of maps.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.