-
-
Save tomjack/015a51c3058c7e9d1f40 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
(defn digit-seq | |
([divisor] | |
(digit-seq divisor 1)) | |
([divisor last-remainder] | |
(let [dividend (* last-remainder 10) | |
result (quot dividend divisor) | |
remainder (rem dividend divisor)] | |
(lazy-seq (cons result (digit-seq divisor remainder)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment