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

Suggestion - getindices!() #119

Open
Lincoln-Hannah opened this issue Mar 2, 2023 · 1 comment
Open

Suggestion - getindices!() #119

Lincoln-Hannah opened this issue Mar 2, 2023 · 1 comment

Comments

@Lincoln-Hannah
Copy link

Lincoln-Hannah commented Mar 2, 2023

what about a function like:

getindices!(d::Dictionary, i::Vector{Symbol}) = filter!( ∈(getindices( d, i )), d )

This implementation only works for unique Dictionary values but it demonstrates the desired functionality.

Could be used to shrink a set of dictionaries to a common set of keys

using Dictionaries, Lazy, Underscores

D1 = Dictionary([:a,:b,:c],[10,11,12])
D2 = Dictionary([:a,:b,:d],[21,22,23])
D3 = Dictionary([:a,:b,:e],[31,32,33])

Common_Indices = @_@>   [D1,D2,D3]   keys.()   intersect(_...)  Indices

getindices!.( [D1,D2,D3]   , [Common_Indices] )
@Lincoln-Hannah Lincoln-Hannah changed the title Suggestion - Suggestion - getindices!() Mar 2, 2023
@Lincoln-Hannah
Copy link
Author

Or could there be a function Comomn_Indices! or Inner_Join! that takes a Vector of Dictionaries and (as above) converts them all to a common set of keys

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

1 participant