Created
April 12, 2016 02:46
-
-
Save AlexWheeler/84503e2fe46c37f2f2dcd31a294e49f8 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 even-or-odd | |
"Collects even and odd numbers" | |
[numbers] | |
(reduce (fn [new-list number] | |
(if (even? number) | |
(conj (:even new-list) number) | |
(conj (:odd new-list) number) | |
) | |
) | |
{:even [] :odd []} | |
numbers | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment