.. include:: ../global.rst .. idio:currentmodule:: SRFI-14 char-set Functions ------------------ :lname:`Idio` uses a "sparse char-set" implementation for char-sets which is essentially an array of bitsets, one per Unicode plane which can be ``#f`` if the plane is unused. .. _`SRFI-14/char-set?`: .. idio:function:: SRFI-14/char-set? o test if `o` is an sparse-char-set :param o: object to test :return: ``#t`` if `o` is an sparse-char-set, ``#f`` otherwise Is `o` a char-set? :param o: value to test :type o: any :return: boolean .. _`SRFI-14/make-sparse-char-set`: .. idio:function:: SRFI-14/make-sparse-char-set size [planes] Create a sparse-char-set of `size` elements. If an array of 17 elements is also supplied it will be used as the planes of the sparse-char-set otherwise an empty array of 17 elements will be used. .. _`SRFI-14/sparse-char-set?`: .. idio:function:: SRFI-14/sparse-char-set? o test if `o` is an sparse-char-set :param o: object to test :return: ``#t`` if `o` is an sparse-char-set, ``#f`` otherwise .. _`SRFI-14/char-set`: .. idio:function:: SRFI-14/char-set [cps] Return a character set containing the given code points. The character set will be the same size as :ref:`char-set:empty `. .. _`SRFI-14/copy-char-set`: .. idio:function:: SRFI-14/copy-char-set cs Return a copy of char-set `cs` .. _`SRFI-14/string->char-set`: .. idio:function:: SRFI-14/string->char-set str [base?] Return a char-set derived from the code points in `str`. Use :ref:`char-set:empty ` as the inital char-set unless `base?` is supplied. :param str: string to use to set code points :type str: string :param base?: initial char-set, defaults to :ref:`char-set:empty ` :type base?: char-set, optional .. _`SRFI-14/ucs-range->char-set`: .. idio:function:: SRFI-14/ucs-range->char-set s e [base?] Return a char-set derived from the range of code points from `s` to `e` inclusive. Use :ref:`char-set:empty ` as the inital char-set unless `base?` is supplied. :param s: starting code point :type s: unicode :param e: ending code point :type e: unicode :param base?: initial char-set, defaults to :ref:`char-set:empty ` :type base?: char-set, optional .. _`SRFI-14/char-set->string`: .. idio:function:: SRFI-14/char-set->string cs Return a string derived from the code points in `cs`. .. _`SRFI-14/char-set-ref`: .. idio:function:: SRFI-14/char-set-ref scs cp Is the code point `cp` in the character set `cs`? :param scs: char-set :type scs: struct-instance :param cp: code point :type cp: unicode or fixnum :return: boolean .. _`SRFI-14/char-set-set!`: .. idio:function:: SRFI-14/char-set-set! scs cp Add the code point `cp` to the character set `cs` :param scs: char-set :type scs: struct-instance :param cp: code point :type cp: unicode or fixnum :return: boolean .. _`SRFI-14/char-set-clear!`: .. idio:function:: SRFI-14/char-set-clear! cs cp Remove the code point from character set cs. .. _`SRFI-14/char-set-contains?`: .. idio:function:: SRFI-14/char-set-contains? scs cp Is the code point `cp` in the character set `cs`? :param scs: char-set :type scs: struct-instance :param cp: code point :type cp: unicode or fixnum :return: boolean .. _`SRFI-14/char-upcase`: .. idio:function:: SRFI-14/char-upcase cp Return the uppercase variant of ``cp`` if one exists or cp :param cp: code point :type cp: unicode :return: uppercase variant of ``cp`` :rtype: unicode .. _`SRFI-14/char-downcase`: .. idio:function:: SRFI-14/char-downcase cp Return the lowercase variant of ``cp`` if one exists or cp :param cp: code point :type cp: unicode :return: lowercase variant of ``cp`` :rtype: unicode .. _`SRFI-14/and-char-set`: .. idio:function:: SRFI-14/and-char-set [css] Logical AND the code points from the character sets. If no arguments are passed the return value is :ref:`char-set:empty `. .. _`SRFI-14/ior-char-set`: .. idio:function:: SRFI-14/ior-char-set [css] Logical Inclusive OR the code points from the character sets. If no arguments are passed the return value is :ref:`char-set:full `. .. _`SRFI-14/merge-char-set`: .. idio:function:: SRFI-14/merge-char-set [css] Logical Inclusive OR the code points from the character sets. If no arguments are passed the return value is :ref:`char-set:full `. .. _`SRFI-14/xor-char-set`: .. idio:function:: SRFI-14/xor-char-set [css] Logical eXclusive OR the code points from the character sets. If no arguments are passed the return value is :ref:`char-set:empty `. .. _`SRFI-14/not-char-set`: .. idio:function:: SRFI-14/not-char-set cs Logical complement the code points from the character set. .. _`SRFI-14/char-set-adjoin`: .. idio:function:: SRFI-14/char-set-adjoin cs [cps] Add the code points to character set cs. .. _`SRFI-14/char-set-adjoin!`: .. idio:function:: SRFI-14/char-set-adjoin! cs [cps] Add the code points to character set cs with side-effects. .. _`SRFI-14/char-set-delete`: .. idio:function:: SRFI-14/char-set-delete cs [cps] Delete the code points from character set cs. .. _`SRFI-14/char-set-delete!`: .. idio:function:: SRFI-14/char-set-delete! cs [cps] Delete the code points from character set cs with side-effects. .. _`SRFI-14/complement-char-set`: .. idio:function:: SRFI-14/complement-char-set cs Logical complement the code points from the character set. .. _`SRFI-14/complement-char-set!`: .. idio:function:: SRFI-14/complement-char-set! cs Complement the code points from character set cs with side-effects. .. _`SRFI-14/union-char-set`: .. idio:function:: SRFI-14/union-char-set [css] Logical Inclusive OR the code points from the character sets. If no arguments are passed the return value is :ref:`char-set:full `. .. _`SRFI-14/union-char-set!`: .. idio:function:: SRFI-14/union-char-set! [css] Union of the code points from character set cs with side-effects. If no arguments are passed the return value is a copy of :ref:`char-set:empty `. .. _`SRFI-14/intersection-char-set`: .. idio:function:: SRFI-14/intersection-char-set [css] Logical AND the code points from the character sets. If no arguments are passed the return value is :ref:`char-set:empty `. .. _`SRFI-14/intersection-char-set!`: .. idio:function:: SRFI-14/intersection-char-set! [css] Intersection of the code points from character set cs with side-effects. If no arguments are passed the return value is a copy of :ref:`char-set:full `. .. _`SRFI-14/difference-char-set`: .. idio:function:: SRFI-14/difference-char-set cs [css] Subtract the code points of the character sets css from cs. .. _`SRFI-14/difference-char-set!`: .. idio:function:: SRFI-14/difference-char-set! cs [css] Subtract the code points of the character sets css from cs with side-effects. .. _`SRFI-14/fold-char-set`: .. idio:function:: SRFI-14/fold-char-set cs f v Invoke `f` on each code point in char-set `cs` and `v` returning the accumulated `v` .. _`SRFI-14/char-set-for-each-set`: .. idio:function:: SRFI-14/char-set-for-each-set cs f Invoke `f` on each code point in char-set `cs` .. include:: ../commit.rst