Bridget and Guru are both right about the reason that \3 is found at position 13 in the string. However, the code you typed isn't valid Clojure, since the pos function expects pred to be a function of v. Thus, your pos call would need to look like this:
(pos #(= % \3) ":a 4 :b 1 :c 3 :d 4") => (13) ;; note that pos returns a list of all indeces matching pred Alternatively, you could have defined pos to simply perform equality matching on its first argument like so: (defn pos [val coll] (for [[i v] (index coll) :when (= val v)] i)) (pos \3 ":a 4 :b 1 :c 3 :d 4") => (13) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.