Public API
This page lists exported symbols of CTBase.Descriptions.
From CTBase.Descriptions
CTBase.Descriptions [Module]
CTBase.Descriptions Module
DescriptionsDescription management utilities for CTBase.
This module provides types and functions for working with symbolic descriptions, including type aliases, manipulation functions, and completion utilities.
Organization
The Descriptions module is organized into thematic submodules:
types.jl: Core type definitions (DescVarArg, Description)
similarity.jl: Similarity computation and intelligent suggestions
display.jl: Display utilities for descriptions
catalog.jl: Catalog management functions (add, remove)
complete.jl: Description completion utilities
Public API
Exported Types
DescVarArg: Variable number of symbols type aliasDescription: Tuple of symbols type alias
Exported Functions
add: Add descriptions to a catalogcomplete: Find matching descriptions with intelligent suggestionsremove: Remove symbols from descriptions
DescVarArg [Constant]
CTBase.Descriptions.DescVarArg Constant
A type alias representing a variable number of Symbols.
Example
julia> using CTBase
julia> CTBase.DescVarArg
Vararg{Symbol}See also: CTBase.Descriptions.Description
Description [Struct]
CTBase.Descriptions.Description Type
struct Tuple{Vararg{Symbol}}A description is a tuple of symbols, used to declaratively encode algorithms or configurations.
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)See also: CTBase.Descriptions.DescVarArg
add [Function]
CTBase.Descriptions.add Function
add(
_::Tuple{},
y::Tuple{Vararg{Symbol}}
) -> Tuple{Tuple{Vararg{Symbol}}}Initialize a new description catalog with a single description y.
Arguments
y::Description: The initial description to add.
Returns
Tuple{Vararg{Description}}: A one-element tuple containingy.
Throws
- (none)
Example
julia> using CTBase
julia> descriptions = ()
julia> descriptions = CTBase.add(descriptions, (:a,))
(:a,)
julia> print(descriptions)
((:a,),)
julia> descriptions[1]
(:a,)See also: CTBase.Descriptions.Description, CTBase.Descriptions.complete, CTBase.Descriptions.remove
add(
x::Tuple{Vararg{Tuple{Vararg{Symbol}}}},
y::Tuple{Vararg{Symbol}}
) -> Tuple{Tuple{Vararg{Symbol}}}Add the description y to the catalog x if it is not already present.
Arguments
x::Tuple{Vararg{Description}}: Existing description catalogy::Description: Specific description to add
Returns
Tuple{Vararg{Description}}: The updated catalog withyappended
Throws
IncorrectArgument: If the descriptionyis already contained inx
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,))
Got: (:b,)
Expected: a unique description not in the catalog
Suggestion: Check existing descriptions before adding, or use a different description
Context: description catalog managementSee also: CTBase.Descriptions.complete, CTBase.Descriptions.remove
complete [Function]
CTBase.Descriptions.complete Function
complete(list::Symbol...; descriptions)Select the most matching description from a catalog based on a partial list of symbols.
If multiple descriptions contain all the symbols in list, the one with the largest intersection is selected. If multiple descriptions have the same intersection size, the first one in the catalog wins (priority is top-to-bottom).
Arguments
list::Symbol...: A variable number of symbols representing a partial description
Keyword Arguments
descriptions::Tuple{Vararg{Description}}: A catalog of candidate descriptions
Returns
Description: The best-matching description from the catalog
Throws
AmbiguousDescription: If the catalog is empty or if no description contains all symbols inlist.
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
Description: (:f,)
Valid candidates:
- (:a, :b)
- (:a, :b, :c)
- (:b, :c)
- (:a, :c)
Suggestion: Available descriptions: (:a, :b), (:a, :b, :c), (:b, :c), (:a, :c)
Context: description completionSee also: CTBase.Descriptions._compute_similarity, CTBase.Descriptions._find_similar_descriptions, CTBase.Descriptions._format_description_candidates, CTBase.Exceptions.AmbiguousDescription
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 fromdescriptionsthat contains all symbols inlist.
Throws
CTBase.Exceptions.AmbiguousDescription: Ifdescriptionsis empty, or iflistis not contained in any candidate description.
See also: CTBase.Descriptions.complete, CTBase.Exceptions.AmbiguousDescription
remove [Function]
CTBase.Descriptions.remove Function
remove(
x::Tuple{Vararg{Symbol}},
y::Tuple{Vararg{Symbol}}
) -> Tuple{Vararg{Symbol}}Remove symbols from a description tuple.
Arguments
x::Description: The source description.y::Description: The symbols to remove fromx.
Returns
Tuple{Vararg{Symbol}}: The set difference ofxandyas a tuple (symbols inxnot iny).
Example
julia> using CTBase
julia> CTBase.remove((:a, :b, :c), (:a,))
(:b, :c)See also: CTBase.Descriptions.add, CTBase.Descriptions.complete