I was asking because my timings show that the lazy version is the fastest one.
My (very simple & stupid) test is: (defn flatten-maps "The original one" ....) (defn flatten-maps-lazy "The lazy one" ....) (defn flatten-maps-eager "The eager one" ....) (defn flatten-maps-recur "Using recur" ....) And data is: (def data [{:a 1 :b 1 :c [{:a 2 :b 2 :c [{:a 3 :b 3 :c []}]} {:a 4 :b 4 :c []}]} {:a 5 :b 5 :c [{:a 6 :b 6 :c [{:a 7 :b 7 :c []}]} {:a 8 :b 8 :c []}]}]) That is, the original data but with different numbers to check if the result is ok: (time (flatten-maps data)) user=> "Elapsed time: 0.14 msecs" ({:a 5, :b 5} {:a 1, :b 1} {:a 4, :b 4} {:a 2, :b 2} {:a 3, :b 3} {:a 8, :b 8} {:a 6, :b 6} {:a 7, :b 7}) (time (flatten-maps-lazy data)) user=> "Elapsed time: 0.034 msecs" ({:a 1, :b 1} {:a 2, :b 2} {:a 3, :b 3} {:a 4, :b 4} {:a 5, :b 5} {:a 6, :b 6} {:a 7, :b 7} {:a 8, :b 8}) (time (flatten-maps-eager data)) user=> "Elapsed time: 0.129 msecs" [{:a 1, :b 1} {:a 2, :b 2} {:a 3, :b 3} {:a 4, :b 4} {:a 5, :b 5} {:a 6, :b 6} {:a 7, :b 7} {:a 8, :b 8}] (time (flatten-maps-recur data)) user=> "Elapsed time: 0.129 msecs" ({:a 8, :b 8} {:a 7, :b 7} {:a 6, :b 6} {:a 5, :b 5} {:a 4, :b 4} {:a 3, :b 3} {:a 2, :b 2} {:a 1, :b 1}) So my tests show that the fastest is the lazy one. Regards, Juan Manuel -- 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