You want either `reduce` or `loop` as the control flow construct, and 
`conj` for appending items to a collection (without resorting to 
mutability). Have a look at them, they're pretty well covered in the 
available books, tutorials etc.

Hope it helps - Victor


On Friday, February 15, 2013 12:11:24 AM UTC+1, Jonathon McKitrick wrote:
>
> I have a loop over a function that is accumulating a list of database keys 
> for later use.  But it is primarily doing other processing and returning a 
> collection of processed/filtered records.  I'd normally just PUSH the ids 
> and records onto a list in Common Lisp, or even LOOP... COLLECT into 2 
> lists.  In the Clojure way, how would I build this auxiliary list without 
> using a mutable collection?  Would it make sense to return a map or some 
> other structure from the processing function that would contain both the 
> processed record as well as any id of interest?  I could accumulate this 
> result, then filter the map into 2 collections - one of processed records 
> and the other a subset of id's of interest.  But that seems kludgy 
> commingling the results like that.

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to