Problem #157 in 4Clojure.com is listed as a very simple problem. Despite having used Clojure’s map function a lot, I saw the solution to this problem recursively using loop and recur, by walking through each element of the function and determining its count. The following solution came from http://blog.qinjian.me/2012/12/21/4clojure_solutions/ . Look for #157 in the midst of quite a few solutions.
(fn __[coll] (loop [x (- (count coll) 1) l ] (if (>= x 0) (recur (- x 1) (conj l (list (nth coll x) x))) (reverse l))))
This solution makes more sense to me than this solution.
#(map list % (range))
It just doesn’t look as obvious. But the prevailing wisdom is to use Clojure’s sequence functions to handle problems like this.