Created
August 13, 2011 04:34
-
-
Save swannodette/1143483 to your computer and use it in GitHub Desktop.
apat.clj
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 addup | |
([xs] (addup xs 0 0)) | |
([xs ones twos] | |
(match [xs ones twos] | |
[[] _ _] [ones twos] | |
[[1 & r] _ _] (recur r (inc ones) twos) | |
[[2 & r] _ _] (recur r ones (+ twos 2))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment