Hi, Am 18.05.2009 um 12:42 schrieb Konrad Hinsen:
Such a use of binding will lead to bad surprises as soon as you use it with lazy sequences: (map #(lcm % 6) (range 6)) -> (0 6 6 6 12 30) (binding [clojure.contrib.math/gcd (fn [a b] 1)] (map #(lcm % 6) (range 6))) -> (0 6 6 6 12 30) You have to use doall to get the result you expect:
As with any other resource be like a Closable in a with-open block or the resulset-seq of a database. The doall is always necessary when you pass a lazy seq outside your region of authority, .. in case it uses a resource. This is not limited to binding. Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature