Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.Map
- import Data.List
- foo (x : xs) = foldr (\x, y -> (cycles ! x) !! (y 'rem' 4)) (x 'rem' 10) xs
- where cycles = fromAscList [(0, [0, 0, 0, 0])
- ,(1, [1, 1, 1, 1])
- ,(2, [6, 2, 4, 8])
- ,(3, [1, 3, 9, 9])
- ,(4, [6, 4, 6, 4])
- ,(5, [5, 5, 5, 5])
- ,(6, [6, 6, 6, 6])
- ,(7, [1, 7, 9, 3])
- ,(8, [6, 8, 4, 2])
- ,(9, [1, 9, 1, 9])]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement