Skip to content
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

Feature Request: sort!(::UnfrozenLittleDict{K,V}) #51

Open
iamed2 opened this issue Jul 21, 2020 · 1 comment
Open

Feature Request: sort!(::UnfrozenLittleDict{K,V}) #51

iamed2 opened this issue Jul 21, 2020 · 1 comment

Comments

@iamed2
Copy link
Contributor

iamed2 commented Jul 21, 2020

sort!(::UnfrozenLittleDict{K,V}) would be nice to have.

Are there any problems with:

function sort!(d::UnfrozenLittleDict; byvalue::Bool=false, args...)
    if byvalue
        p = sortperm(d.vals; args...)
    else
        p = sortperm(d.keys; args...)
    end
    permute!(d.keys, p)
    permute!(d.vals, p)
    return d
end

?

@oxinabox
Copy link
Member

Looks reasonable to me.
I think I just forgot to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants