The bitset! datatype

This datatype was made specifically so that parse could work efficiently with strings consisting of Unicode values. It is used to store an arbitrary set of characters as Boolean values, that is, as a set of bits.

A value of the bitset! type is created with make bitset!, accepting a character, string, an integer (within the Unicode codepoint range), or a series of these values, such as these:

;-- see Chapter08/bitsets.red:make bitset! #"R"              ;== make bitset! #{0000000000000000000020}make bitset! "Red"             ;== make bitset! #{0000000000000000000020000C}make bitset! [108 "Red" #"R"]  ;== make bitset! #{0000000000000000000020000C08}

Note that a bitset value is represented in hexadecimal format. A convenient shortcut function that ...

Get Learn Red - Fundamentals of Red now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.