Re: Looping and accumulation

2013-02-15 Thread Jonathon McKitrick
So it looks like this might be perfect for what I need. I need to track a hash of the key fields of inserted db records so I can skip duplicates without db access. On Thursday, February 14, 2013 7:35:20 PM UTC-5, Luc wrote: > Look at the first example here: > > http://clojuredocs.org/clojure_

Re: Looping and accumulation

2013-02-15 Thread Jonathon McKitrick
On Thursday, February 14, 2013 7:44:18 PM UTC-5, Stephen Compall wrote: > On Feb 14, 2013 6:11 PM, "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 col

Re: Looping and accumulation

2013-02-14 Thread Stephen Compall
On Feb 14, 2013 6:11 PM, "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. As you come from Common Lisp, where all standard l

Re: Looping and accumulation

2013-02-14 Thread Softaddicts
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

Re: Looping and accumulation

2013-02-14 Thread vemv
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