Let's say I want to write a function that takes as an argument a list
of n numbers, and returns 4 lists, a list of odd numbers that are
multiples of 5, a list of even numbers that are multiples of 5, a list
of odd numbers that are not multiples of 5, and a list of even numbers
that are not multiples of 5.

If I were writing this function procedurally, I could create 4 empty
lists, and iterate through my input list once, using a compound if
statement to add to the appropriate list.

In functional style, I could use filter, but I can't seem to think of
a solution that doesn't end up iterating through the whole list
multiple times.

Can someone please teach me what is the correct clojure approach?
Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to