Closed raam86 closed 4 years ago
indexOf is expected to find the first index on the given value while unison provides the index of the first value encountered in a binary search :
test> tests.http.utils.indexof.happy = run (expect ((base.Search.indexOf 1 [1,1]) == Some 0)) :no_entry_sign: FAILED
In Haskell:
Data.List.elemIndex 1 [1,1] => Just 0
Suggestion would be to change the function name to anyIndexOf and adding a simple indexOf function to List
Fixed in https://github.com/unisonweb/base/commit/18aa864dc6b34fdb941c45f93c55745aac588d45
I think the Search functions could also use tests, docs, and examples though.
Search
indexOf is expected to find the first index on the given value while unison provides the index of the first value encountered in a binary search :
In Haskell:
Suggestion would be to change the function name to anyIndexOf and adding a simple indexOf function to List