How to evaluate a sequence of impure functions in Clojure?
问题 How can I evaluate a list of (impure) functions in Clojure? For instance: [#(println "1") #(println "2") #(println "3")] The expected output is: 1 2 3 Is there a way to achieve this without using macros? Something like (map evaluate fns-seq) , maybe? (I need this for drawing some graphics using the Clojure.processing API.) 回答1: user> (let [fs [#(println "1") #(println "2") #(println "3")]] (doseq [f fs] (f))) 1 2 3 nil 回答2: This will eagerly consume the whole seq, calling all functions for