Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created February 4, 2015 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/d0fcb798b3ca9c94f758 to your computer and use it in GitHub Desktop.
Save shigemk2/d0fcb798b3ca9c94f758 to your computer and use it in GitHub Desktop.
main = do
print $ foldl (+) 0 $ take 10 [1..]
-- print $ take 10 $ foldl (\x y -> y : x) [] [1..] -- 無限ループ
print $ take 10 $ foldr (\a b -> [a] ++ b) [] [1..]
-- print $ take 10 $ foldl (\a b -> [a] ++ b) [] [1..] -- エラー
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment