Does this seem like a good way to choose between doall, dorun, doseq and for to evaluate all the items in sequences?
Ask these questions: Do you already have the lazy sequence in a variable or do you still need to build it? If you already have it, use dorun or doall. Otherwise use doseq or for. While code inside a dorun or doall could build the sequence, using doseq and for are considered more idiomatic/readable. Also, they provide list comprehension features such as processing more than one sequence and filtering with :when/:while. For example, instead of using the following to get a new sequence where all the items are multiplied by two: (doall (map #(* % 2) my-coll)) use this: (for [item my-coll] (* item 2)) Are you only interested in side effects of the evaluations or do you need to retain the results? If you only need side effects, use dorun or doseq. If you need the results, use doall or for. -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---