wyrm::sym operation parameter...
::wyrm::sym encode [ string|set ] Tcl-list-representation
::wyrm::sym decode [ string|set ] symbol-string-set
::wyrm::sym empty string
::wyrm::sym length string
::wyrm::sym first string
::wyrm::sym rest string
::wyrm::sym last string
::wyrm::sym front string
::wyrm::sym index string position
::wyrm::sym range string first last
::wyrm::sym reverse string
::wyrm::sym label graph graph component property [ string ]
::wyrm::sym unlabel string
::wyrm::sym nest string
::wyrm::sym unnest string
::wyrm::sym nested string
::wyrm::sym enum var string [ while expr ] script
A symbol is any nonempty string of characters. The string is not interpretted beyond symbols are equal or no if their character strings are equal or no.
A symbol string is an orderred list of symbols. Some characters are reserved in the symbol string representation; if they occur they are replaced with an escape sequence. The sym encode command will convert reserved characters into escape sequences. The sym decode command will convert escape sequences back into the characters again.
The empty string is represented by characters "#NS". It is the string with no member symbols.
The reserved characters are comma ",", vertical bar "|", full stop ".", open brace "{", close brace "}", quote """, backslash "\", at sign "@", colon ":", white space, or a hash "#" followed by "NS" or two hexidecimal digits. Angle marks are reserved to enclose nested symbol sets. A reserved character is escaped by replacing it with "#" followed by the two hexidecimal digit ASCII code of the character. However unless the string representations are directly manipulated, it should not be necessary to worry about escaping; commands are provided to convert between Tcl lists of strings and symbol set strings, and escaping is removed when individual symbols are returned.
::wyrm::sym null set
::wyrm::sym card set
::wyrm::sym intersect set...
::wyrm::sym union set...
::wyrm::sym diff set...
::wyrm::sym concat set...
::wyrm::sym contains A B
::wyrm::sym equals A B
::wyrm::sym prefix set
::wyrm::sym suffix set
::wyrm::sym each var set [ while expr ] script
::wyrm::sym choose set [ var [ such expr ] ]
A symbol set is an unorderred set of of symbol strings. The string representation uses the character vertical bar "|"; this is regarded as reserved character of symbol strings, and if it appears in a symbol, it is escaped by the symbol string escaping.
The null set is a represented by an empty Tcl string {}. It is the set that has no members. It is important to distinguish the null set and the empty symbol string; the null set is represented by an empty Tcl string, while an empty symbol string is represented by the special non-empty Tcl string "#NS".
A singleton set is a set with exactly one member. Notationally a symbol string and a singleton set are identical.
sym concat a|b p,q|r,s y|z
returnsa,p,q,y|a,p,q,z|a,r,s,y|a,r,s,z|b,p,q,y|b,p,q,z|b,r,s,y|b,r,s,z
::wyrm::sym vertex graph [ [ -re|-glob ] pattern ]
::wyrm::sym edge graph [ [ -re|-glob ] pattern ]
::wyrm::sym from graph vertex
::wyrm::sym to graph vertex
::wyrm::sym invert graph
::wyrm::sym subgraph graph vertex-set
::wyrm::sym scc graph [ vertex ]
::wyrm::sym memb graph component
::wyrm::sym factor graph component-set...
component list ::= {vertex...}
::wyrm::sym tsort graph [ vertex-set ]
In addition to symbol strings and sets, the sym command operates on directed graphs and assignable functions.
A directed graph is a symbol string set interpretted as a description of vertices and edges. The symbol strings in the set have length either one or two. A length one string is the name of vertex. A length two string is the name of the from vertex and to vertex of an edge. Vertices need not be listed unless they are isolated; it suffices to specify an edge containing them. The general form is
For example:
Because graphs are represented by sets, the usual set operations apply; for example graphs can be merged with the union command. However set and string labels are ignored; graph components need to be labelled with the sym-label-graph subcommand.
If the graph has cycles and one of the vertices in a cycle is specified on the command, that vertex is used to break the cycle: the vertex forced to be orderred less than all other vertices in the cycle. If more than one vertex in the cycle is given, any of the vertices might be selected.
::wyrm::sym grammar command-name [ other-grammar ]