Skip to content

Commit a19832c

Browse files
committed
Use foldl in multicol setindex
1 parent b06ea0b commit a19832c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/model.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,9 @@ end
205205
@inline Base.setindex(m::AbstractModel, xs, i::Integer, ::Colon) = Base.setindex(m, xs, i, filter(!_isreserved, keys(m)))
206206
@inline Base.setindex(m::AbstractModel, xs, i::Integer, ::Type{Val{col}}) where col = _setindex(m, xs, i, Val{col})
207207
@inline function Base.setindex(m::AbstractModel, xs, i::RowIndexer, cols::Union{Tuple,AbstractVector})
208-
for col in cols
209-
m = Base.setindex(m, Tables.getcolumn(xs, col), i, Val{col})
208+
return foldl(cols; init=m) do m, col
209+
Base.setindex(m, Tables.getcolumn(xs, col), i, col)
210210
end
211-
return m
212211
end
213212
@inline function Base.setindex(m::AbstractModel, xs, i::AbstractVector{<:Integer}, ::Type{Val{col}}) where col
214213
@assert !_isreserved(col) "column name :$col is reserved and cannot be modified"

0 commit comments

Comments
 (0)