Skip to content

Commit

Permalink
try the ordered Dict representation mentioned in #10092
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 29, 2015
1 parent 6b4c275 commit ecf5033
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 135 deletions.
10 changes: 3 additions & 7 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1458,15 +1458,11 @@ end
function setdiff(a, b)
args_type = promote_type(eltype(a), eltype(b))
bset = Set(b)
ret = Array(args_type,0)
seen = Set{eltype(a)}()
seen = Set{args_type}()
for a_elem in a
if !in(a_elem, seen) && !in(a_elem, bset)
push!(ret, a_elem)
push!(seen, a_elem)
end
!in(a_elem, bset) && push!(seen, a_elem)
end
ret
collect(seen)
end
# symdiff is associative, so a relatively clean
# way to implement this is by using setdiff and union, and
Expand Down
Loading

0 comments on commit ecf5033

Please sign in to comment.