DEV Community

loading...

Discussion on: Daily Challenge #16 - Number of People on the Bus

Collapse
tarptaeya profile image
Anmol Gautam

Haskell

passengers :: [(Int, Int)] -> Int
passengers xs = sum $ map (\x -> fst x - snd x) xs

main = print $ passengers [(1, 0), (2, 1), (5, 3), (4, 2)]