public
Created

  • Download Gist
preserving.hs
Haskell
1 2 3 4 5 6 7
-- Ref: http://goo.gl/L8Fzi
ghci> let keep2 f a b = (f a b, a, b)
ghci> let if' cond x y = if cond then x else y
ghci> let compose2 f g = (f .) . g
ghci> let uncurry3 f = \(a, b, c) -> f a b c
ghci> (uncurry3 if' `compose2` keep2 ((<) `on` length)) [1, 2] [2, 4, 5]
[1,2]

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.