Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Bitset Source Code
 previous   up   next 

Types
bitset
Sets of integer numbers.
set of (attr integer)
Alternate name for bitset.

bitset

const type: bitset

Sets of integer numbers.


set of

const type: set of (attr integer)

Alternate name for bitset.

set of integer

is an alternate name for bitset.


Operator Summary
bitset
(in bitset: set1) | (in bitset: set2)
Union of two sets.
bitset
(in bitset: set1) & (in bitset: set2)
Intersection of two sets.
bitset
(in bitset: set1) >< (in bitset: set2)
Symmetric difference of two sets.
bitset
(in bitset: set1) - (in bitset: set2)
Difference of two sets.
void
(inout bitset: dest) |:= (in bitset: delta)
Assign the union of delta and dest to dest.
boolean
(in bitset: set1) = (in bitset: set2)
Check if two sets are equal.
boolean
(in bitset: set1) <> (in bitset: set2)
Check if two sets are not equal.
boolean
(in bitset: set1) < (in bitset: set2)
Determine if set1 is a proper subset of set2.
boolean
(in bitset: set1) > (in bitset: set2)
Determine if set1 is a proper superset of set2.
boolean
(in bitset: set1) <= (in bitset: set2)
Determine if set1 is a subset of set2.
boolean
(in bitset: set1) >= (in bitset: set2)
Determine if set1 is a superset of set2.
boolean
(in integer: number) in (in bitset: aSet)
Set membership test.
boolean
(in integer: number) not in (in bitset: aSet)
Negated set membership test.
void
(inout bitset: aSet) @:= [ (in integer: number) ] (in boolean: isElement)
Add or remove aValue to respectively from sSet.
integer
(attr integer) conv (in bitset: aSet)
Convert a bitset to integer.
bitset
(attr bitset) conv (in integer: number)
Convert an integer number to a bitset.
bitset
(attr bitset) parse (in var string: stri)
Convert a string to a bitset.

Function Summary
integer
compare (in bitset: set1, in bitset: set2)
Compares two sets to make them useable as key in a hash table.
integer
hashCode (in bitset: aSet)
Compute the hash value of a bitset.
void
incl (inout bitset: aSet, in integer: number)
Add number to the set aSet.
void
excl (inout bitset: aSet, in integer: number)
Remove number from the set aSet.
integer
card (in bitset: aSet)
Compute the cardinality of a set.
integer
rand (in bitset: aSet)
Compute pseudo-random number which is element of aSet.
integer
min (in bitset: aSet)
Minimal element of a set.
integer
max (in bitset: aSet)
Maximal element of a set.
void
for (inout integer: forVar) range (in bitset: aSet) do (in proc: statements) end for
For-loop where forVar loops over the elements of the set aSet.
array integer
toArray (in bitset: aSet)
Obtain an array containing all the values in aSet.
string
str (in bitset: aSet)
Convert a bitset to a string.

Operator Detail

|

const func bitset: (in bitset: set1) | (in bitset: set2)

Union of two sets.

Returns:
the union of the two sets.
Raises:
MEMORY_ERROR - Not enough memory for the result.

&

const func bitset: (in bitset: set1) & (in bitset: set2)

Intersection of two sets.

Returns:
the intersection of the two sets.
Raises:
MEMORY_ERROR - Not enough memory for the result.

><

const func bitset: (in bitset: set1) >< (in bitset: set2)

Symmetric difference of two sets.

Returns:
the symmetric difference of the two sets.
Raises:
MEMORY_ERROR - Not enough memory for the result.

-

const func bitset: (in bitset: set1) - (in bitset: set2)

Difference of two sets.

Returns:
the difference of the two sets.
Raises:
MEMORY_ERROR - Not enough memory for the result.

|:=

const proc: (inout bitset: dest) |:= (in bitset: delta)

Assign the union of delta and dest to dest.

Raises:
MEMORY_ERROR - Not enough memory to create dest.

=

const func boolean: (in bitset: set1) = (in bitset: set2)

Check if two sets are equal.

Returns:
TRUE if the two sets are equal, FALSE otherwise.

<>

const func boolean: (in bitset: set1) <> (in bitset: set2)

Check if two sets are not equal.

Returns:
FALSE if the two sets are equal, TRUE otherwise.

<

const func boolean: (in bitset: set1) < (in bitset: set2)

Determine if set1 is a proper subset of set2. set1 is a proper subset of set2 when

set1 <= set2 and set1 <> set2

holds.

Returns:
TRUE if set1 is a proper subset of set2, FALSE otherwise.

>

const func boolean: (in bitset: set1) > (in bitset: set2)

Determine if set1 is a proper superset of set2. set1 is a proper superset of set2 when

set1 >= set2 and set1 <> set2

holds.

Returns:
TRUE if set1 is a proper superset of set2, FALSE otherwise.

<=

const func boolean: (in bitset: set1) <= (in bitset: set2)

Determine if set1 is a subset of set2. set1 is a subset of set2 when no element X exists for which

X in set1 and X not in set2

holds.

Returns:
TRUE if set1 is a subset of set2, FALSE otherwise.

>=

const func boolean: (in bitset: set1) >= (in bitset: set2)

Determine if set1 is a superset of set2. set1 is a superset of set2 when no element X exists for which

X in set2 and X not in set1

holds.

Returns:
TRUE if set1 is a superset of set2, FALSE otherwise.

in

const func boolean: (in integer: number) in (in bitset: aSet)

Set membership test. Determine if number is a member of the set aSet.

Returns:
TRUE when number is a member of aSet, FALSE otherwise.

not in

const func boolean: (in integer: number) not in (in bitset: aSet)

Negated set membership test. Determine if number is not a member of the set aSet.

Returns:
FALSE when number is a member of aSet, TRUE otherwise.

@:= [

const proc: (inout bitset: aSet) @:= [ (in integer: number) ] (in boolean: isElement)

Add or remove aValue to respectively from sSet. Adding an existing value or remove a non-existing value leaves aSet unchanged.

Raises:
MEMORY_ERROR - When there is not enough memory.

conv

const func integer: (attr integer) conv (in bitset: aSet)

Convert a bitset to integer. E.g.:

integer conv {2, 3, 5, 7, 11}

returns 2220

Returns:
an integer which corresponds to the given bitset.
Raises:
RANGE_ERROR - When aSet contains negative values or when it does not fit into an integer.

conv

const func bitset: (attr bitset) conv (in integer: number)

Convert an integer number to a bitset. E.g.:

bitset conv 2220

returns {2, 3, 5, 7, 11}

Returns:
a bitset which corresponds to the given integer.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

parse

const func bitset: (attr bitset) parse (in var string: stri)

Convert a string to a bitset.

Returns:
the integer result of the conversion.
Raises:
RANGE_ERROR - When the string is empty or cannot be converted to a bitset.

Function Detail

compare

const func integer: compare (in bitset: set1, in bitset: set2)

Compares two sets to make them useable as key in a hash table. The sets are compared by determining the biggest element that is not present or absent in both sets. The set in which this element is not present is the smaller one. Note that the set comparison is not related to the concepts of subset or superset. With the comparison function compare it is posible to sort an array of sets or to use sets as key in a hash table.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in bitset: aSet)

Compute the hash value of a bitset.

Returns:
the hash value.

incl

const proc: incl (inout bitset: aSet, in integer: number)

Add number to the set aSet. When number is already in aSet then aSet stays unchanged.

Raises:
MEMORY_ERROR - When there is not enough memory.

excl

const proc: excl (inout bitset: aSet, in integer: number)

Remove number from the set aSet. When number is not element of aSet then aSet stays unchanged.


card

const func integer: card (in bitset: aSet)

Compute the cardinality of a set.

Returns:
the number of elements in aSet.

rand

const func integer: rand (in bitset: aSet)

Compute pseudo-random number which is element of aSet. The random values are uniform distributed.

Returns:
a random number such that rand(aSet) in aSet holds.
Raises:
RANGE_ERROR - When aSet is empty.

min

const func integer: min (in bitset: aSet)

Minimal element of a set. Delivers the element from aSet for which the following condition holds:

element <= X

for all X which are in the set.

Returns:
the minimum element of aSet.
Raises:
RANGE_ERROR - When aSet is the empty set.

max

const func integer: max (in bitset: aSet)

Maximal element of a set. Delivers the element from aSet for which the following condition holds:

element >= X

for all X which are in the set.

Returns:
the maximal element of aSet.
Raises:
RANGE_ERROR - When aSet is the empty set.

for

const proc: for (inout integer: forVar) range (in bitset: aSet) do (in proc: statements) end for

For-loop where forVar loops over the elements of the set aSet.


toArray

const func array integer: toArray (in bitset: aSet)

Obtain an array containing all the values in aSet.

Returns:
all the values from aSet.

str

const func string: str (in bitset: aSet)

Convert a bitset to a string.

Returns:
the string result of the conversion.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.


 previous   up   next