As Sean suggested you should use doseq instead of for and map to force
side-effects:
http://clojuredocs.org/clojure_core/clojure.core/doseq
Since doseq uses the exact same syntax as for, you should just write doseq
in its place. map should be converted to doseq syntax, too.
Balint
On Monday,
So what should I do? would using fmap helps?
I have used let initially, but I moved away to make it as close as possible
to my repl code/.
On Sunday, December 2, 2012 8:31:55 PM UTC-5, Sean Corfield wrote:
Part of it is laziness: map is lazy so it doesn't do anything unless you
use the
I am playing with clojurescript, and I have this code:
(defn prepare [number]
(def targets (take 4 (drop (* 4 (- number 1)) (dom/getElementsByClass
place-div
(def target-objects (map #(make-target %) targets))
(for [drag draggables target target-objects]
(.addTarget drag target))
Part of it is laziness: map is lazy so it doesn't do anything unless you
use the result. In the REPL, you print the result so map runs across the
whole sequence. In the function, only the last expression (draggables) is
returned so it is the only thing fully evaluated.
Your code is very