for and doseq in Clojure
Notes
;; for_and_doseq.clj
(doseq [i (range 1 11)]
(print i ", "))
(for [i (range 1 11)]
(print i ", "))
(print 5)
(def dice-faces (range 1 7))
(for [x dice-faces y dice-faces]
[x y])
(doseq [x dice-faces y dice-faces]
[x y])
(doseq [x dice-faces y dice-faces]
(println [x y]))
(for [x dice-faces y dice-faces]
(println [x y]))
(defn roll-of-two-dices-doseq []
(let [dice-faces (range 1 7)]
(doseq [x dice-faces y dice-faces]
[x y])))
(defn roll-of-two-dices []
(let [dice-faces (range 1 7)]
(for [x dice-faces y dice-faces]
[x y])))