Commentary: Operators, Miscellaneous

General:. Operators of a general nature or those that do not fit logically into other groupings are illustrated here.

To String ( %* ): All Glee objects have a :string method that can be invoked to convert them to a string representation. This operator simply calls that method.

To Verbose String ( %** ): All Glee objects have a :stringv method that can be invoked to convert them to a verbose string representation. This operator simply calls that method. Verbose representations are principally used for troubleshooting and documentation.

Show Glee Collating Sequence (#CSGLEE): By default, comparisons in Glee use the Glee rules. This may be manually overridden using the @== prefix operator. Glee comparisons treat various characters as identical. They also treat the " - " (dash) and " ' " (apostrophy) as being non-existent. This allows better handling of hyphenated words and contractions. The collating sequence can be reset to default at any time with the statement #nil => #CSGLEE or '' => #CSGLEE. Thus the collating sequence can be set and reset with ease to obtain desired results for most sorts and character comparisons. #CSGLEE returns a 256 integer vector. The positions of the integers in the vector correspond to the positions of characters in the ascii character set. The value of the integer is its relative precedence (lower numbers preceed higher numbers). You see that 0's predominate in this result. All characters corresponding to those 0's are taken as identical and are sorted below (more precedence than) non-zero characters. The number in the character position is the order in which it sorts.

Set Glee Collating Sequence (=> #CSGLEE):The are four modes to consider here. The modes are recognizable to the interpreter by the type of data being assigned.
  Mode 1: ''=> #CSGLEE or #nil => #CSGLEE resets to the default Glee collating sequence. This sequence treats similar alphabetics as being identical for comparison purposes (i.e. 'AaÀÁÂÃÄÅàáâãäå' are all just 'a'). Glee also ignores '-' and '`' when making comparisons. This mitigates some issues with hyphenated words and contractions. If these characters were not ignored, for example, a hyphenated word would not be treated as a single word.
  Mode 2: Assigning a character string sets the collating sequence. For example, 'a'..'z', 'A'..'Z', '0'..'9' => #CSGLEE sets a normal alphanumerical sequence with all other characters being treated with identical and lower precedence.
  Mode 3: A sequence of character strings. Glee has the special power to treat collections of characters with equal precedence. This is needed for ignoring case and accents when comparing words. These collections are presented as a sequence of character vectors. For example: 'AaÀÁÂÃÄÅàáâãäå' 'Bb' 'Cc' 'DdÐ' 'EeÈÉÊËèéêë' ... => #CSGLEE is the technique used for collecting these characters. Another common form is 'a'..'z' ,|('A'..'Z') => #CSGLEE to have comparisons ignore case. These operators create a sequence of character pairs like 'aA' 'bB' ... 'zZ'.
  Mode 4:This is the 256 element numeric vector form. It is most commonly used to capture and restore collating sequences. For example, #CSGLEE => cs ; 0..255 => #CSGLEE; ... some operations ...; cs => #CSGLEE;. This would use the normal ascii sequence and then return to the existing sequence.

Reset Glee Collating Sequence (#nil => #CSGLEE):. You reset to the default collating sequence by assigning #nil or ''  to #CSGLEE (actually any object with 0 elements will do it). This example also illustrates a way to display the current collating sequence. The grouping operator ``& is used to group identical ordering precedences. It returns in index origin 1 the positions of characters with like precedence. #ea '-1' subtracts 1 yielding the origin 0 form #asc expects. The <- _1 drops from the display the first item which is all the characters with unassigned precedence . The result is formatted with ,,\ presenting the sequence for human consumption. You might try removing the drop to see which characters are being ignored. These characters aren't actually ignored. They are taken as whitespace and extraneous whitespace is removed when comparisons are made.

Show Exact Collating Sequence(#CSExact): The exact collating sequence is applied when comparison sensitive operators are preceeded with the @== operator. This sets a switch in the object that tells the comparison operators how to behave. Exact comparisons are different than Glee comparisons. With exact comparisons the precedence of all characters is defined and significant. For Glee comparisons, many characters are treated as whitespace and sort to the end of the collation. Further, with Glee comparisons, the characters " ' " and " - " are elided in making the comparison. This keeps contractions and hyphenated words from being seen as two separate words by operators like \& which breaks a string into words.

Setting Exact Collating Sequence ( => #CSExact ): . There are three modes for setting the Exact collating sequence. There is no sequence mode as supported for #CSGLEE.
  Mode 1: ''=> #CSExact or #nil => #CSExact resets to the default exact collating sequence. This is a more logical ordering than the normal ascii ordering. The collating sequence can be viewed with 0..255 #asc @== >>> .
  Mode 2:Assigning a character string establishes that string as the collating sequence. For example '0'..'9' => #CSExact gives most precedence to numeric characters. Any characters not contained in the string maintain their existing precedence but below the characters in the string. The straight ascii collating sequence can be achieved with 0..255 #asc => #CSExact.
  Mode 3: Assigning a 256 element numeric vector. This gives the precedence for each correspending character in the ascii set. Exact comparison operators require that each character have a unique precedence. Glee assures this by grading this numeric vector and using that grade. Thus, duplicates or numbers less than 0 or greater than 255 will not be problematic. This mode is most commonly used for preserving a collating sequence and later restoring it. For example #CSExact => cs; 0..255 => #CSExact; ... some operations...; cs => #CSExact.

Scope:Glee brings a chain of namespaces into a block. If a symbol does not exist in the namespace (or any higher namespace in the chain) the scope is _1. If that block takes you into another block, a new namespace is added to the chain. In any block, the local namespace (the last one added) is at scope 0; the parent (calling block and next namespace up the chain) at scope 1; and so on. Glee can read objects at any higher scope unless an object of the same name shadows the object at a lower (more local) scope. References to objects passed into a block in a namespace are given scope 0. Their scope increases with each enclosing block. Assigning to references at scope 0 or 1 replaces the referant. References seen at scope greater than 1 are dereferenced (i.e. you get a copy). Thus, assignment to these does not change the referant. Further, once shadowed in this fashion, the reference is no longer accessible for assignment to referant in additional blocks called.

#SYS: System Class. The system class #SYS is very experimental. As I begin to write real GLEE programs and need to condition the system or know its condition, I will create that functionality in this class. This demonstrates the use of the operator to produce a namespace dump.

: .