Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created January 18, 2012 02:04
Show Gist options
  • Select an option

  • Save diegopacheco/1630341 to your computer and use it in GitHub Desktop.

Select an option

Save diegopacheco/1630341 to your computer and use it in GitHub Desktop.
Lambda in Haskell
map (\x -> x + 3) [1,6,3,2] -- [4,9,6,5]
map (\(a,b) -> a + b) [(1,2),(3,5),(6,3),(2,6),(2,5)] -- [3,8,9,8,7]
-- add.hs
addThree :: (Num a) => a -> a -> a -> a
addThree = \x -> \y -> \z -> x + y + z
--
-- ghci add.hs
--
addThree 2 2 2 -- 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment