Skip to content

Commit

Permalink
Fix copy, simplify show (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyferris authored Jan 31, 2024
1 parent 7811b93 commit 28998b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/DictTable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ function Base.filter!(pred, t::DictTable)
return t
end

function Base.copy(t::DictTable)
inds = copy(keys(t))
cols = _similar(inds, eltype(t))
out = DictTable{keytype(t), eltype(t), typeof(cols), typeof(inds)}(cols, inds)
copyto!(out, t)
return out
end

# Column-based operations: Some operations on rows are faster when considering columns

Base.map(::typeof(identity), t::DictTable) = copy(t)
Expand Down
2 changes: 1 addition & 1 deletion src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function showtable(io::IO, @nospecialize(t), keyname)
else
col = cols[col_inds[i-1]]
if isassigned(col, row_ind)
push!(strings[i], compact_string(t[row_ind][col_inds[i-1]]))
push!(strings[i], compact_string(col[row_ind]))
else
push!(strings[i], "#undef")
end
Expand Down

0 comments on commit 28998b1

Please sign in to comment.