Created
August 14, 2011 09:10
-
-
Save nipra/1144727 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
user> (iter {for x from 1 to 10} | |
{reduce x by conj initially [] into odds if (odd? x)} | |
{reduce x by conj initially [] into evens if (even? x)} | |
{sum x into sum-odds if (odd? x)} | |
{sum x into sum-evens if (even? x)} | |
{returning {:evens evens | |
:odds odds | |
:sum-odds sum-odds | |
:sum-evens sum-evens}}) | |
{:evens [2 4 6 8 10], :odds [1 3 5 7 9], :sum-odds 25, :sum-evens 30} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment