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

Make accumulate and cumsum return Dictionary #148

Open
jariji opened this issue Oct 22, 2024 · 1 comment
Open

Make accumulate and cumsum return Dictionary #148

jariji opened this issue Oct 22, 2024 · 1 comment

Comments

@jariji
Copy link

jariji commented Oct 22, 2024

I wish this kept the keys.

julia> let d = Dictionary([1,2,3], [10,20,30])
           cumsum(d)
       end
3-element Vector{Int64}:
 10
 30
 60

I can do it myself

julia> let d = Dictionary([1,2,3], [10,20,30])
           Dictionary(keys(d), cumsum(d))
       end
3-element Dictionary{Int64, Int64}
 110
 230
 360

it would just be nicer if I didn't have to.

@andyferris
Copy link
Owner

That’s a good idea. Currently it must be falling back to the Base method.

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