I need to pull sequence ids from a db, which is a lot like using a generator. I found this thread about generators:
https://groups.google.com/forum/?fromgroups=#!searchin/clojure/generator/clojure/IL_ONPb52-0/S_2p2-vjVCYJ which suggests using seqs, like so: (defn sines [] (cycle (map #(Math/sin %) (range 0 6.28 0.01)))) (doseq [s (take num-iters (sines))] (println s)) However my case is more complex, because there's not a single call (like doseq, above) consuming the seq. I'm processing structured data, and need to get ids for the leaf nodes. So it looks more like (defn process-row [row] (map #(process-value (get-id) %) row)) (map process-row rows) That is, process-row gets called multiple times, and needs to retrieve ids. If I pass in a seq of ids, I'll get the same ids each time. If I try to work around this by, say, have process-row return the number of ids consumed, and doing a "drop n" when calling process-row the next time, I'm holding the seq head (which I can't afford). Is there some other way to do this? -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
