Last active
April 23, 2019 20:24
-
-
Save Lifelovinglight/8604744777ab978348be990fa4419e8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unfold :: (a -> Bool) -> (a -> a) -> a -> [a] | |
unfold stop step init | stop init = [] | |
| otherwise = init : unfold stop step (step init) | |
modulo = curry $ length . unfold (uncurry (>)) (\dn -> subtract (fst dn) <$> dn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment