Skip to content

Instantly share code, notes, and snippets.

@tomjack
Created March 8, 2010 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjack/015a51c3058c7e9d1f40 to your computer and use it in GitHub Desktop.
Save tomjack/015a51c3058c7e9d1f40 to your computer and use it in GitHub Desktop.
(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