This is the design I like: a u32 vector such that each even element is the starting code point of an interval and each odd element is the ending code point + 1 of an interval, where the intervals are in order. A binary search determines whether an element is in or out of the set. Intersection is merge, and complement is "prepend #x00000 to the set and remove the last element, unless the set already begins with #x00000, in which case remove it and append #x200000".
See https://github.com/scheme-requests-for-implementation/srfi-14/blob/master/co... for how to make standard character set definitions that conform to Unicode rather than Java 1.0.
On Wed, May 17, 2023 at 1:34 PM Bradley Lucier lucier@math.purdue.edu wrote:
Marc:
I'd like to have an implementation of SRFI 14 (character sets) that works with the entire unicode character set rather than just the 256-character Latin1 subset
I think one needs a data structure that allows compact encoding of relatively large (about $2^{21}$ elements) sets of positive integers that have lots of contiguous subsets.
At any rate, I thought you may have solved this problem in gambit/lib/gambit/char/char#.scm, but for the life of me I can't figure out what you're doing there.
Can your data sets for encoding Unicode properties be used for an efficient SRFI 14 implementation?
Brad
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list