Created
February 4, 2015 12:39
-
-
Save shigemk2/641043e3bbf2f6fc94a6 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
-- 括弧を省略して$に書き換えることができちゃう | |
main = do | |
print $ sum (filter (> 10) (map (*2) [2..10])) | |
print $ sum $ filter (> 10) (map (*2) [2..10]) | |
print $ sum $ filter (> 10) $ map (*2) [2..10] | |
-- $ は関数適用それ自身を関数として扱えるようにするために使えます | |
print $ map ($ 3) [(4+), (10*), (^2), sqrt] | |
-- print $ [(4+), (10*), (^2), sqrt] -- これは出来ない | |
print $ take 10 $ map (+ 3) [1..] | |
print $ map ($ 3) $ take 10 $ map (+) [1..] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment