Clojurescript does not seem to have an explicit index-of method (at least not the one I can find with a reasonable amount of search queries).
As an example, you can map clojurescript data structures to javascript arrays and use your own javascript .indexOf
=> (.indexOf (clj->js [:a :b :c :d]) (clj->js :c)) => 2
But there are two problems with this: first, you have to leave the world of persistent data structures, which is a big part of what makes clojurescript great, but the big problem is that it does not work in reference types. For instance.
=> (.indexOf (clj->js [{:a :b} {:c :d}]) (clj->js {:c :d})) => -1
therefore it is of limited use.
Your own recursive solution is perfect in the circumstances. If you want something more functional, you can do:
(defn index-of [coll v] (let [i (count (take-while
source share