- char-set-complement csprocedure
- char-set-union cs_1 ...procedure
- char-set-intersection cs_1 ...procedure
- char-set-difference cs_1 cs_2 ...procedure
- char-set-xor cs_1 ...procedure
- char-set-diff+intersection cs_1 cs_2 ...procedure
These procedures implement set complement, union, intersection, difference, and exclusive-or for character sets. The union, intersection and xor operations are n-ary. The difference function is also n-ary, associates to the left (that is, it computes the difference between its first argument and the union of all the other arguments), and requires at least one argument.
Boundary cases:
(char-set-union) => char-set:empty (char-set-intersection) => char-set:full (char-set-xor) => char-set:empty (char-set-difference CS) => CS
char-set-diff+intersection returns both the difference and the intersection of the arguments -- it partitions its first parameter. It is equivalent to
(values (char-set-difference CS_1 CS_2 ...) (char-set-intersection CS_1 (char-set-union CS_2 ...)))
but can be implemented more efficiently.
Programmers should be aware that char-set-complement could potentially be a very expensive operation in Scheme implementations that provide a very large character type, such as 32-bit Unicode. If this is a possibility, sets can be complimented with respect to a smaller universe using char-set-difference.