On 6 Jun 2010, at 15:30, Jon Seltzer wrote:
> I'm still learning Clojure and doing so by reading everything on
> clojure.org. I ran across this example in the Functional Programming
> section:
>
> (defn my-zipmap [keys vals]
> (loop [my-map {}
> my-keys (seq keys)
> my-vals (seq vals)]
> (if (and my-keys my-vals)
> (recur (assoc my-map (first my-keys) (first my-vals))
> (rest my-keys)
> (rest my-vals))
> my-map)))
>
> (my-zipmap [:a :b :c] [1 2 3])
>
> However, when run, it hangs.
Empty seqs are logically true, so your "if" condition is always true.
-Steve
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en