wes
wes

Reputation: 33

Clojure Loop and count

I am trying to get a link for each photoset. It should look like this:

[:p (link-to (str "/album?photosetid="photosetid) photoset-name)

In the following code I get a map of all photoset ids and names:

(def ids (map #(str "/album?photosetid=" %1) photoset-id))
(def names (map #(str  %1) photoset-name))

After that i try to create the links:

  (loop [x (count ids)]
    (when (> x 0)
      [:p (link-to (nth ids x "") name) (nth names x "")]
      (recur (- x 1))
      )
    )

The problem is that I don't get any output.

Thanks for any help!

Upvotes: 1

Views: 462

Answers (1)

Leon Grapenthin
Leon Grapenthin

Reputation: 9266

(map #(vector :p (link-to (str "/album?photosetid=" %1) %2)) ids names)

Upvotes: 3

Related Questions