{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/28426","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/28426/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/28426/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/28426/events","html_url":"https://github.com/JuliaLang/julia/issues/28426","id":347387066,"node_id":"MDU6SXNzdWUzNDczODcwNjY=","number":28426,"title":"Wrong docstring: selectperm ","user":{"login":"Wikunia","id":4931746,"node_id":"MDQ6VXNlcjQ5MzE3NDY=","avatar_url":"https://avatars0.githubusercontent.com/u/4931746?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikunia","html_url":"https://github.com/Wikunia","followers_url":"https://api.github.com/users/Wikunia/followers","following_url":"https://api.github.com/users/Wikunia/following{/other_user}","gists_url":"https://api.github.com/users/Wikunia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikunia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikunia/subscriptions","organizations_url":"https://api.github.com/users/Wikunia/orgs","repos_url":"https://api.github.com/users/Wikunia/repos","events_url":"https://api.github.com/users/Wikunia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikunia/received_events","type":"User","site_admin":false},"labels":[{"id":115619,"node_id":"MDU6TGFiZWwxMTU2MTk=","url":"https://api.github.com/repos/JuliaLang/julia/labels/doc","name":"doc","color":"02d7e1","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-03T13:00:19Z","updated_at":"2018-08-08T19:02:49Z","closed_at":null,"author_association":"NONE","body":"I think the behavior of `selectperm` does not fully match the documentation:\r\nLink to documentation:\r\nhttps://github.com/JuliaLang/julia/blob/release-0.6/base/docs/helpdb/Base.jl#L1231-L1243\r\n\r\nFull text:\r\n\r\n> Return a partial permutation of the vector `v`, according to the order specified by\r\n> `by`, `lt` and `rev`, so that `v[output]` returns the first `k` (or range of adjacent values\r\n> if `k` is a range) values of a fully sorted version of `v`. If `k` is a single index\r\n> (Integer), an array of the first `k` indices is returned; if `k` is a range, an array of\r\n> those indices is returned. Note that the handling of integer values for `k` is different\r\n> from [`select`](@ref) in that it returns a vector of `k` elements instead of just the `k` th\r\n> element. Also note that this is equivalent to, but more efficient than, calling\r\n> `sortperm(...)[k]`.\r\n\r\nIf I have the array `a = [4,3,2,1]` and use `selectperm(a,2)` I can read this part:\r\n\r\n> If `k` is a single index (Integer), an array of the first `k` indices is returned;\r\n\r\nthen the expected behavior is: to get `[4,3]` as `a[[4,3]]` is `[1,2]` but regarding this:\r\n\r\n>  Also note that this is equivalent to, but more efficient than, calling\r\n> `sortperm(...)[k]`.\r\n\r\nI would suspect to get only a single index (`3`) which is what `selectperm` actually does.\r\n\r\nUsing it without documentation I assumed to get `[4,3]` but I'm also happy to use `selectperm(a,1:2)`. Anyway the documentation seems to be wrong.\r\n\r\nHappy to change the docstring if the function works as it should. ;)\r\n\r\nCross-posted: \r\nhttps://discourse.julialang.org/t/selectperm-bug-or-wrong-documentation/12852"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/411516799","html_url":"https://github.com/JuliaLang/julia/issues/28426#issuecomment-411516799","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/28426","id":411516799,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTUxNjc5OQ==","user":{"login":"Wikunia","id":4931746,"node_id":"MDQ6VXNlcjQ5MzE3NDY=","avatar_url":"https://avatars0.githubusercontent.com/u/4931746?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikunia","html_url":"https://github.com/Wikunia","followers_url":"https://api.github.com/users/Wikunia/followers","following_url":"https://api.github.com/users/Wikunia/following{/other_user}","gists_url":"https://api.github.com/users/Wikunia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikunia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikunia/subscriptions","organizations_url":"https://api.github.com/users/Wikunia/orgs","repos_url":"https://api.github.com/users/Wikunia/repos","events_url":"https://api.github.com/users/Wikunia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikunia/received_events","type":"User","site_admin":false},"created_at":"2018-08-08T19:02:49Z","updated_at":"2018-08-08T19:02:49Z","author_association":"NONE","body":"Alright. I'll do it tomorrow.\r\nBtw I think this one is wrong as well:\r\nhttps://github.com/JuliaLang/julia/blob/d386e40c17d43b79fc89d3e579fc04547241787c/base/sort.jl#L573-L603\r\n\r\nIn the list of parameters it says: Default unstable and in the description it says default is a stable merge sort. \r\nI didn't have a look in the code but I assume that the default is a stable merge sort. "}}
{"actor":{"display_login":"Wikunia"}}