On Sep 27, 2010, at 9:45 AM, Glen Rubin wrote: > I have a vector of numbers > > [0 99 3334 53 2 5 99 2 55 63] > > I'd like to find the first index of a particular value. For example > if the value was 99 then I want to return 1, b/c the index of 99 is > 1. I can do this with a loop/recur structure comparing each value in > the list to my desired value, however am wondering if there isn't a > built-in for doing so?? thanks again!
In general, 'some' is used for linear searches. Given a vector 'v': (some #(and (= 99 (v %)) %) (range 0 (count v))) This is awkward because you're asking for the index and not the value itself. Index-based array manipulation is not often used in Clojure. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to firstname.lastname@example.org 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