Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import Data.Map
  2. import Data.List
  3.  
  4. foo (x : xs) = foldr (\x, y -> (cycles ! x) !! (y 'rem' 4)) (x 'rem' 10) xs
  5. where cycles = fromAscList [(0, [0, 0, 0, 0])
  6. ,(1, [1, 1, 1, 1])
  7. ,(2, [6, 2, 4, 8])
  8. ,(3, [1, 3, 9, 9])
  9. ,(4, [6, 4, 6, 4])
  10. ,(5, [5, 5, 5, 5])
  11. ,(6, [6, 6, 6, 6])
  12. ,(7, [1, 7, 9, 3])
  13. ,(8, [6, 8, 4, 2])
  14. ,(9, [1, 9, 1, 9])]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement