Skip to content

Instantly share code, notes, and snippets.

@frenchy64
Last active December 21, 2015 00:39
Show Gist options
  • Save frenchy64/6222078 to your computer and use it in GitHub Desktop.
Save frenchy64/6222078 to your computer and use it in GitHub Desktop.
(cljs.core.typed/cf
(defn ^{:ann '[(U nil (cljs.core/ISeqable Any)) Any -> int]}
index-of [xs x]
(let [len (count xs)]
(cljs.core.typed/loop> [i :- int, 0]
(if (< i len)
(if (= (nth xs i) x)
i
(recur (inc i)))
-1))))))
;=> Any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment