Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nalimilan committed Apr 23, 2021
1 parent 7291a96 commit f2b9f73
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ it doesn't do this itself to avoid doing a dict lookup twice
i
end

function mergelevels(ordered, levels...)
"""
mergelevels(ordered::Bool, levels::AbstractVector...) -> (vec::Vector, ordered′::Bool)
Merge vectors of values `levels` and return:
- `vec`: a superset of all values in `levels`, respecting orders of values
in each vector of levels if possible
- `ordered′`: if `ordered=true`, whether order comparisons between all pairs
of levels in `vec` have a defined result based on orders of values in input `levels`
"""
function mergelevels(ordered::Bool, levels::AbstractVector...)
T = cat_promote_eltype(levels...)
res = Vector{T}(undef, 0)

Expand Down Expand Up @@ -214,6 +223,7 @@ end
end
end

# Efficient equivalent of issubset(levels(a), levels(b)), i.e. ignoring order
function Base.issubset(a::CategoricalPool, b::CategoricalPool)
pa = pointer_from_objref(a)
pb = pointer_from_objref(b)
Expand Down

0 comments on commit f2b9f73

Please sign in to comment.