The Haskell equivalent of Clojure's "juxt" is "sequence".
It took me a while to find this - I was sure it would be possible but couldn't work it out. To apply a list of functions to an argument, generating a list of the results:
-- Clojure
((juxt inc dec (partial * 3)) 4) ; => [5 3 12]
-- Haskell
sequence [succ, pred, (*3)] 4 -- [5, 3, 12]
Written by Russell Dunphy
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Clojure
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#