Instantly share code, notes, and snippets.

Embed
What would you like to do?
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