-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the kind of indices returned by findmin
/findmax
/argmin
/argmax
#46705
Conversation
…/`argmax` This is the sentence used for `find*` functions, introduced by #25577. Also change "the domain of `f`" to "`domain`" as the domain of `f` can be a superset of the passed `domain`.
base/reduce.jl
Outdated
@@ -870,12 +870,15 @@ end | |||
""" | |||
findmax(f, domain) -> (f(x), index) | |||
|
|||
Returns a pair of a value in the codomain (outputs of `f`) and the index of | |||
Returns a pair of a value in the codomain (outputs of `f`) and the index or key of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the index vs key difference explained or at least mentioned anywhere in the docs? I've always seen them used interchangeably in julia and package docs.
Is there any difference at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indicies are a special case of keys. For Arrays they are the same, but Dicts have keys but not indices. If we just mentioned keys here, that would be correct but obtuse because folks shouldn't need to know that Arrays as have keys to understand findmax(::Function, ::Array)
.
I'm not sure if the difference is explicitly mentioned or explained elsewhere, but I don't think this PR is the place for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Arrays they are the same, but Dicts have keys but not indices.
Interesting, I've always thought they are synonyms! Why getindex
and not getkey
then?
UPD: getkey
exists but does a very different operation.
(of course not for this PR specifically, but in general)
Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
This is the sentence used for
find*
functions, introduced by #25577.Also change "the domain of
f
" to "domain
" as the domain off
can be a superset of the passeddomain
.(Spotted at JuliaData/DataFrames.jl#3139.)