Skip to content

Commit 7072871

Browse files
committed
Fix for Set constructor changes (JuliaLang/julia#5897)
1 parent 21c0f48 commit 7072871

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/dataframe/dataframe.jl

+5-2
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,11 @@ end
203203

204204
# Initialize from a Vector of Associatives (aka list of dicts)
205205
function DataFrame{D <: Associative}(ds::Vector{D})
206-
ks = [Set([[k for k in [collect(keys(d)) for d in ds]]...]...)...]
207-
DataFrame(ds, ks)
206+
ks = Set()
207+
for d in ds
208+
union!(ks, keys(d))
209+
end
210+
DataFrame(ds, [ks...])
208211
end
209212

210213
# Initialize from a Vector of Associatives (aka list of dicts)

src/formula/formula.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ allvars(sym::Symbol) = [sym]
6464
allvars(v::Any) = Array(Symbol, 0)
6565

6666
# special operators in formulas
67-
const specials = Set(:+, :-, :*, :/, :&, :|, :^)
67+
const specials = Set([:+, :-, :*, :/, :&, :|, :^])
6868

6969
function dospecials(ex::Expr)
7070
if ex.head != :call error("Non-call expression encountered") end
@@ -84,7 +84,7 @@ function dospecials(ex::Expr)
8484
end
8585
dospecials(a::Any) = a
8686

87-
const associative = Set(:+,:*,:&) # associative special operators
87+
const associative = Set([:+,:*,:&]) # associative special operators
8888

8989
## If the expression is a call to the function s return its arguments
9090
## Otherwise return the expression
@@ -117,7 +117,7 @@ getterms(a::Any) = a
117117
ord(ex::Expr) = (ex.head == :call && ex.args[1] == :&) ? length(ex.args)-1 : 1
118118
ord(a::Any) = 1
119119

120-
const nonevaluation = Set(:&,:|) # operators constructed from other evaluations
120+
const nonevaluation = Set([:&,:|]) # operators constructed from other evaluations
121121
## evaluation terms - the (filtered) arguments for :& and :|, otherwise the term itself
122122
function evt(ex::Expr)
123123
if ex.head != :call error("Non-call expression encountered") end
@@ -146,7 +146,7 @@ function Terms(f::Formula)
146146
unshift!(oo, 1)
147147
end
148148
ev = unique(vcat(etrms...))
149-
facs = int8(hcat(map(x->(s=Set(x...);map(t->int8(t in s), ev)),etrms)...))
149+
facs = int8(hcat(map(x->(s=Set(x);map(t->int8(t in s), ev)),etrms)...))
150150
Terms(tt, ev, facs, oo, haslhs, !any(noint))
151151
end
152152

0 commit comments

Comments
 (0)