Skip to content

Instantly share code, notes, and snippets.

@m0smith
Created September 28, 2011 22:35
Show Gist options
  • Save m0smith/1249439 to your computer and use it in GitHub Desktop.
Save m0smith/1249439 to your computer and use it in GitHub Desktop.
Convert a number into a lazy sequence of digits as (digit-seq 1798) => (1 7 9 8)
(defn digit-seq
"Convert a number into a lazy sequence of digits as (digit-seq 1798) => (1 7 9 8)"
[num] (map #(- (int %) (int \0)) (str num)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment