Skip to content

Commit

Permalink
Use OrderedCollections
Browse files Browse the repository at this point in the history
Closes #392
  • Loading branch information
timholy committed Sep 20, 2018
1 parent bdd7aa0 commit fcc6d17
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 584 deletions.
4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.12.0"

[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand All @@ -13,3 +14,6 @@ Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[targets]
test = ["Test", "Primes", "Random", "Serialization"]

[compat]
OrderedCollections = "1.0.1"
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
julia 0.7
OrderedCollections 1.0.1
9 changes: 3 additions & 6 deletions src/DataStructures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module DataStructures
eachindex, keytype, valtype
import Base: iterate

using InteractiveUtils: methodswith
using OrderedCollections
import OrderedCollections: filter, filter!, isordered

export complement, complement!

Expand Down Expand Up @@ -67,10 +68,8 @@ module DataStructures
include("disjoint_set.jl")
include("heaps.jl")

include("dict_support.jl")
include("ordered_dict.jl")
include("ordered_set.jl")
include("default_dict.jl")
include("dict_support.jl")
include("trie.jl")

include("int_set.jl")
Expand All @@ -88,8 +87,6 @@ module DataStructures
include("tokens2.jl")
include("container_loops.jl")

include("dict_sorting.jl")

export
CircularBuffer,
capacity,
Expand Down
25 changes: 0 additions & 25 deletions src/dict_sorting.jl

This file was deleted.

5 changes: 1 addition & 4 deletions src/dict_support.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# support functions

# _tablesz and hashindex are defined in Base, but are not exported,
# so they are redefined here.
_tablesz(x::Integer) = x < 16 ? 16 : one(x)<<((sizeof(x)<<3)-leading_zeros(x-1))
hashindex(key, sz) = (reinterpret(Int,(hash(key))) & (sz-1)) + 1
using InteractiveUtils: methodswith

function not_iterator_of_pairs(kv)
return any(x->isempty(methodswith(typeof(kv), x, true)),
Expand Down
Loading

0 comments on commit fcc6d17

Please sign in to comment.