Next: char-sets sets, Previous: char-sets inspect, Up: char-sets [Index]
Return a new set representing the intersection of the arguments; the
intersection is the set of characters present in all the arguments.
When called with no arguments: return a new char-set
representing all the characters in Unicode.
The returned set may share some structure with the arguments.
Return a new set representing the union of the arguments; the union is
the set of characters present in one and/or more arguments. When called
with no arguments: return a new empty char-set
.
The returned set may share some structure with the arguments.
Return a new set representing the difference between the arguments; the
difference is the set of characters from cs0 not present in any of
the cs char-set
objects.
The returned set may share some structure with the arguments.
Return two values: the difference and the intersection of the arguments; it partitions its first argument. It is equivalent to:
(values (char-set-difference cs1 cs2 ...) (char-set-intersection cs1 (char-set-union cs2 ...)))
Return a new set representing the exclusive difference between the arguments: it is the set of characters in only one of the arguments. When called with no arguments: return the empty set.
The returned set may share some structure with the arguments.
Return a new set representing the complement of cs in cs-universe. The complement is the set of characters present in cs-universe, which are not present in cs.
If omitted, cs-universe defaults to char-set:full
.
The returned set may share some structure with the arguments.
Apply proc to each character in cs.
Apply proc to each character in cs; proc must return a
character. Return a new char-set
holding all the characters
returned by proc.
Apply pred to each character in cs. Return a new
char-set
holding all the characters from cs for which
pred returned non–false.
Apply proc to each character in the set and return true if all the
return values are true. The application stops at the first #f
return value.
Apply proc to each character in the set and return true if at least one of the returned values is true. The application stops at the first true return value.
Fold kons over the characters in the set. kons must accept two arguments: The next character from the set and the return value of the previous invocation of kons. At the first application the second argument to kons is knil.
Return a list holding all the characters in the set. Beware that for some character sets the resulting list can be big.
Return a new char-set
holding the characters in the given list
and the characters in the given base-cs.
Return a new character set holding all the characters in string and the characters in base-cs.
Return a new string object holding all the characters from cs. The order in which the characters appear is undefined.
Cursors are a low–level facility for iterating over the characters in a set; a cursor is a value that indexes a character in a char set.
char-set-cursor
returns a new cursor object associated to the
character set cs. There can be multiple cursors associated to the
same character set.
char-set-ref
returns a character object representing the set
element currently indexed by a cursor.
char-set-cursor-next
increments a cursor index and returns a new
cursor indexing the next character in the set; in this way, code can
step through every character in a char set.
Stepping a cursor “past the end” of a char set produces a cursor that
answers true to end-of-char-set?
. It is an error to pass such a
cursor to char-set-ref
or to char-set-cursor-next
.
A cursor value may not be used in conjunction with a different character
set; if it is passed to char-set-ref
or
char-set-cursor-next
with a character set other than the one used
to create it, the results and effects are undefined.
Cursor values are not necessarily distinct from other types: they may be integers, linked lists, records, procedures or other values.
Note that these primitives are necessary to export an iteration facility for char sets to loop macros.
Example:
(define cs (char-set #\G #\a #\T #\e #\c #\h)) ;; Collect elts of CS into a list. (let lp ((cur (char-set-cursor cs)) (ans '())) (if (end-of-char-set? cur) ans (lp (char-set-cursor-next cs cur) (cons (char-set-ref cs cur) ans)))) ⇒ (#\G #\T #\a #\c #\e #\h) ;; Equivalently, using a list unfold (from SRFI 1): (unfold-right end-of-char-set? (curry char-set-ref cs) (curry char-set-cursor-next cs) (char-set-cursor cs)) ⇒ (#\G #\T #\a #\c #\e #\h)
Next: char-sets sets, Previous: char-sets inspect, Up: char-sets [Index]