How do I implement foreach loop in clojure?
问题 Implementing a for loop in clojure seems to be easy, but how can I implement a foreach statement that reads each element in the list(vector) and does something? like this... (foreach i list expression) Thanks in advance! 回答1: Just replace for with doseq and you're all set. Don't use map , which is just as lazy as for . 回答2: map is the functional equivalent of foreach , whereas doseq is for imperative programming with side-effects. map takes a function f and a seqable collection coll and