each f [] = return () each f (x:xs) = do f x each f xs mapp f [] = [] mapp f (x:xs) = f x : mapp f xs filt f [] = [] filt f (x:xs) | f x = x : filt f xs | otherwise = filt f xs redu f i [] = i redu f i (x:xs) = do let a = f i x redu f a xs main = do putStrLn "Hello, World!" print $ mapp (*2) [1..5] print $ filt odd [1..10] print $ redu (\a c -> a * c) 1 [1..5] each print [1..5]
To embed this project on your website, copy the following code and paste it into your website's HTML: