Can we have a function that searches for a given element by value and
Basically what "a in b" does for arrays, only returning an int instead of a bool.
re: naming:
.find(value) or
.index_of(value) or
.first_index_of(value) or
Docs should make clear that it returns the first index of the element that has the same value as the provided one.
Thanks.
I think find(value) will be better?
I think it could be like C#, simple and clean. For example:
arr := [1,2,3,4]
elem := arr.find(3)? // returns ?int
elem_index := arr.first(predicate)? // returns ?T
elements := arr.find_all(predicate)? // returns ?[]T or []T to check
it would be possibile to write a lot of useful and well documented functions, avoiding the boring and verbose Go style
Most helpful comment
I think it could be like C#, simple and clean. For example:
it would be possibile to write a lot of useful and well documented functions, avoiding the boring and verbose Go style