Skip to content

Commit

Permalink
take advantage of ordered Dict/Set in unique
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Feb 8, 2015
1 parent 1adf482 commit 27da02c
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions base/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,7 @@ const ⊆ = issubset
(l::Set, r::Set) = <(l, r)
(l::Set, r::Set) = !(l, r)

function unique(C)
out = Array(eltype(C),0)
seen = Set{eltype(C)}()
for x in C
if !in(x, seen)
push!(seen, x)
push!(out, x)
end
end
out
end
unique(C) = collect(Set(C))

function filter(f::Function, s::Set)
u = similar(s)
Expand Down

0 comments on commit 27da02c

Please sign in to comment.