andyferris / Dictionaries.jl

An alternative interface for dictionaries in Julia, for improved productivity and performance
Other
278 stars 28 forks source link

Make it easier to handle shared indices, and add `empty_type` for new constructor patterns #49

Closed andyferris closed 3 years ago

andyferris commented 3 years ago

Came across these during external work (SplitApplyCombine, TypedTables).

empty_type allows one to determine the type of a new container based on the type of an input container (and new key / element types). It should return a type T that is concrete, has the constructor method T(), and be isinsertable (remember that our empty methods behave more like Base.emptymutable), and is intended to be a type that is "similar" to the input type. It is used internally by empty.

The other changes make it easier to add or remove elements from multiple dictionaries that share common indices via gettoken!, removetoken! and empty!.

I think these patterns and interfaces will begin to settle over time, and then we can document them properly (though I think it would be good to consider sorted collections and possibly more esoteric dictionaries first).

codecov[bot] commented 3 years ago

Codecov Report

Merging #49 (ed8ca83) into master (c000578) will increase coverage by 3.61%. The diff coverage is 62.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
+ Coverage   70.39%   74.00%   +3.61%     
==========================================
  Files          19       19              
  Lines        1699     1708       +9     
==========================================
+ Hits         1196     1264      +68     
+ Misses        503      444      -59     
Impacted Files Coverage Δ
src/insertion.jl 70.80% <ø> (-0.19%) :arrow_down:
src/pairs.jl 60.00% <0.00%> (ø)
src/tokens.jl 21.21% <0.00%> (-0.67%) :arrow_down:
src/Dictionary.jl 64.34% <25.00%> (-1.74%) :arrow_down:
src/reverse.jl 51.42% <25.00%> (ø)
src/filter.jl 63.79% <33.33%> (+3.26%) :arrow_up:
src/ArrayDictionary.jl 69.04% <50.00%> (-2.70%) :arrow_down:
src/map.jl 43.52% <50.00%> (+16.78%) :arrow_up:
src/AbstractDictionary.jl 83.98% <100.00%> (+0.93%) :arrow_up:
src/AbstractIndices.jl 78.26% <100.00%> (+12.63%) :arrow_up:
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c000578...ed8ca83. Read the comment docs.