Created
April 16, 2014 14:43
-
-
Save lsmag/10887190 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map (negate . round . (* 3)) [2.77, 3.02, 5.05, 2.221] | |
-- negate . round . (* 3) | |
-- 1) | |
-- (* 3) ... em Haskell, todos os operadores são funções (e todas as funções são curryied) | |
-- x * y == (* x y) | |
-- logo, (* n) == \x -> (* n x) | |
-- negate . round . (\x -> 3 * x) | |
-- 2) | |
-- o operador "." é de composição... basicamente recebe duas funções e | |
-- retorna uma outra que é a composição dessas. Por exemplo: | |
-- f . g == \x -> f (g x) | |
-- negate . (\x -> round (3 * x)) | |
-- \x -> negate (round (3 * x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment