Skip to content

Instantly share code, notes, and snippets.

@eschulte
Created September 25, 2010 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eschulte/597084 to your computer and use it in GitHub Desktop.
Save eschulte/597084 to your computer and use it in GitHub Desktop.
(defn first-where
"Return the index in coll of the first place where f returns true."
[f coll]
(loop [ind 0 c coll] (if (f (nth c ind)) ind (recur (inc ind) coll))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment