Skip to content

Unintuitive findmin and findmax #39203

Closed
@Moelf

Description

@Moelf

argmin(collection) will return the index of the smallest element in the collection, however, with the newly added:

argmin(f, collection)

it returns the value of the minimal element (with evaluation) instead:

julia> argmin([1,2,-3,5])
3

julia> argmin(identity, [1,2,-3,5])
-3

And this is not even useful since it's just taking the second element from the returned value of findmin(f, collection):

argmin(f, domain) = findmin(f, domain)[2]

We should have argmin/argmax to return index instead.

Metadata

Metadata

Assignees

Labels

breakingThis change will break codesearch & findThe find* family of functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions