Closed darkleaf closed 4 weeks ago
Thanks! I just thought of two more things, but pretty sure these are the last:
{:added "1.9.0"}
metadata to the index-of
function?Thanks for the updates. Can you wrap the docstring at 80 characters, as per a previous comment? e.g.
(defn index-of
"Returns the index of the first occurrence of the item in the sequential
collection coll, or -1 if not found."
{:added "1.9.0"}
[^java.util.List coll item]
(if (nil? coll)
-1
(.indexOf coll item)))
For some reason it's wrapped at a much smaller width. Once that's done I'll merge it in and cut a release.
Thanks!
This doesn't match clojure.string/index-of's behavior (return nil
if not found). Is it intentional to have a mismatch?
I assume the idea was to have it match the .indexOf method. However, it's a good point that the Clojure clojure.string/index-of
function works differently, as it doesn't have to use primitives and also has nil-punning.
I think you're right though, @NoahTheDuke. I think it makes more sense for index-of
to return nil
rather than -1
. I'll make the necessary changes.
Sorry for not noticing until it got merged. 😓
You deserve credit for noticing it and catching it before I released!
Fixes https://github.com/weavejester/medley/issues/54