Look at the first example here:

http://clojuredocs.org/clojure_core/clojure.core/transient

It should inspire you.

Transient structures make this kind of loop run faster but as you lay out
your first iteration just toss this aside (and the xxx! version of conj and 
cie).

Luc P.


> 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.
> 
> 
> 
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad!

-- 
-- 
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