1
0
Fork 0

Day 15 - minor changes in style

This commit is contained in:
Jonathan Chan 2017-12-15 09:33:25 -08:00
parent b12aa2915a
commit 23c6504372
1 changed files with 3 additions and 3 deletions

View File

@ -10,12 +10,12 @@ count :: (Int, Int) -> (Int, Int) -> Int -> Int -> Int
count pair masks acc times = count pair masks acc times =
if times == 0 then acc else if times == 0 then acc else
let !next = nextMaskBy <$$> factors <**> masks <**> pair let !next = nextMaskBy <$$> factors <**> masks <**> pair
!eq = fromEnum . uncurry ((==) `on` (.&. 0xffff)) $ next !eq = fromEnum $ uncurry ((==) `on` (.&. 0xffff)) next
in count next masks (acc + eq) (times - 1) in count next masks (acc + eq) (times - 1)
where where
h <$$> (x, y) = (h x, h y) h <$$> (x, y) = (h x, h y)
(f, g) <**> (x, y) = (f x, g y) (f, g) <**> (x, y) = (f x, g y)
nextMaskBy f d s = let t = (f * s) `mod` divisor in if (t .&. d) == 0 then t else nextMaskBy f d t nextMaskBy f m s = let t = (f * s) `mod` divisor in if (t .&. m) == 0 then t else nextMaskBy f m t
main :: IO () main :: IO ()
main = do main = do