Hi, Am 12.02.2009 um 18:29 schrieb Mark Volkmann:
(def f-infinite-seq (map f (iterate inc 0))) ; values 0 through infinity(println "The first is" (first f-infinite-seq)) (println "The third is" (nth f-infinite-seq 2))
The result is cached in f-infinite-seq. So as long as you hold onto the head of the seq, the value will be there, even if you don't use the result of the "first" call. The solution is probably to not hold onto the head. Either feed the infinite seq directly to the consumer, without storing it in a global Var or a local. Or use a factory function which returns a fresh seq, everytime you call it. (defn f-infinite-seq [] (map f (iterate inc 0))) (println "The first is" (first (f-infinite-seq))) (println "The third is" (nth (f-infinite-seq) 2))) Hope this helps. Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature