Private API

This page lists non-exported (internal) symbols of CTBase.


From CTBase

DescVarArg

CTBase.DescVarArgConstant

DescVarArg is a type alias representing a variable number of Symbols.

julia> using CTBase

julia> CTBase.DescVarArg
Vararg{Symbol}

See also: CTBase.Description.

Description

CTBase.DescriptionType

A description is a tuple of symbols. Description is a type alias for a tuple of symbols.

See also: DescVarArg.

Example

Base.show is overloaded for descriptions, so tuples of descriptions are printed one per line:

julia> using CTBase

julia> display(((:a, :b), (:b, :c)))
(:a, :b)
(:b, :c)

add

CTBase.addFunction
add(
    _::Tuple{},
    y::Tuple{Vararg{Symbol}}
) -> Tuple{Tuple{Vararg{Symbol}}}

Return a tuple containing only the description y.

Example

julia> using CTBase

julia> descriptions = ()
julia> descriptions = CTBase.add(descriptions, (:a,))
(:a,)
julia> print(descriptions)
((:a,),)
julia> descriptions[1]
(:a,)
add(
    x::Tuple{Vararg{Tuple{Vararg{Symbol}}}},
    y::Tuple{Vararg{Symbol}}
) -> Tuple{Tuple{Vararg{Symbol}}}

Add the description y to the tuple of descriptions x if x does not contain y and return the new tuple of descriptions.

Throw an exception (IncorrectArgument) if the description y is already contained in x.

Example

julia> using CTBase

julia> descriptions = ()
julia> descriptions = CTBase.add(descriptions, (:a,))
(:a,)
julia> descriptions = CTBase.add(descriptions, (:b,))
(:a,)
(:b,)
julia> descriptions = CTBase.add(descriptions, (:b,))
ERROR: IncorrectArgument: the description (:b,) is already in ((:a,), (:b,))

complete

CTBase.completeFunction
complete(list::Symbol...; descriptions)

Return one description from a list of Symbols list and a set of descriptions D. If multiple descriptions are possible, then the first one is selected.

If the list is not contained in any of the descriptions, then an exception is thrown.

Example

julia> using CTBase

julia> D = ((:a, :b), (:a, :b, :c), (:b, :c), (:a, :c))
(:a, :b)
(:b, :c)
(:a, :c)
julia> CTBase.complete(:a; descriptions=D)
(:a, :b)
julia> CTBase.complete(:a, :c; descriptions=D)
(:a, :b, :c)
julia> CTBase.complete((:a, :c); descriptions=D)
(:a, :b, :c)
julia> CTBase.complete(:f; descriptions=D)
ERROR: AmbiguousDescription: the description (:f,) is ambiguous / incorrect
complete(list::Tuple{Vararg{Symbol}}; descriptions)

Convenience overload of complete for tuple inputs.

This method is equivalent to complete(list...; descriptions=descriptions).

Arguments

  • list::Tuple{Vararg{Symbol}}: A tuple of symbols representing a partial description.

Keyword Arguments

  • descriptions::Tuple{Vararg{Description}}: Candidate descriptions used for completion.

Returns

  • Description: A description from descriptions that contains all symbols in list.

Throws

  • AmbiguousDescription: If descriptions is empty, or if list is not contained in any candidate description.

remove

CTBase.removeFunction
remove(
    x::Tuple{Vararg{Symbol}},
    y::Tuple{Vararg{Symbol}}
) -> Tuple{Vararg{Symbol}}

Return the difference between the description x and the description y.

Example

julia> using CTBase

julia> CTBase.remove((:a, :b), (:a,))
(:b,)