Skip to content

Instantly share code, notes, and snippets.

@nathanic
Created October 1, 2013 17:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanic/6781788 to your computer and use it in GitHub Desktop.
Save nathanic/6781788 to your computer and use it in GitHub Desktop.
index-of for clojurescript
(defn index-of
"return the index of the supplied item, or nil"
[v item]
(let [len (count v)]
(loop [i 0]
(cond
(<= len i) nil,
(= item (get v i)) i,
:else (recur (inc i ))))))
@dviramontes
Copy link

this works!
thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment