I read Clojure's 2nd Programming Programming, and on page 49 he describes the construction of the Clojure loop, which she says is actually the concept of a sequence.
The authors suggest the following code:
(defn indexed [coll] (map-indexed vector coll)) (defn index-filter [pred col] (when pred (for [[idx elt] (indexed col) :when (pred elt)] idx))) (index-filter
... a Java-based example is preferable, and the evidence suggests that it is "using higher-order functions ... the functional index of any of all avoids the need for variables."
What are "idx", "elt" if they are not variables? Do they mean variables other than batteries?
Also, why is # {\ a} instead of "a"?
source share