September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,8 @@
main :: IO ()
main =
putStrLn . unlines $
[ show . foldr (+) 0 -- sum
, show . foldr (*) 1 -- product
, foldr ((++) . show) "" -- concatenation
] <*>
[[1 .. 10]]

View file

@ -0,0 +1,12 @@
import Data.Monoid
main :: IO ()
main =
let xs = [1 .. 10]
in (putStrLn . unlines)
[ (show . getSum . foldr (<>) mempty) (Sum <$> xs)
, (show . getProduct . foldr (<>) mempty) (Product <$> xs)
, (show . foldr (<>) mempty) (show <$> xs)
, (show . foldr (<>) mempty) (words
"Love is one damned thing after each other")
]

View file

@ -1,5 +0,0 @@
nums = [1..10]
summation = foldl (+) 0 nums
product = foldl (*) 1 nums
concatenation = foldr (\num s -> show num ++ s) "" nums