With Clojure, how do I find the first index with a positive value in this vector [-1 0 3 7 9]
?
I know you can get the first result of something rather elegantly with first
and filter
:
(first (filter pos? [-1 0 99 100 101]))
This code returns the value 99
. The answer I want is the index which is 2
.