1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
[comment {-*- tcl -*- doctools manpage}]
[comment {$Id: struct_set.man,v 1.12 2009/01/29 06:16:20 andreas_kupries Exp $}]
[manpage_begin struct::set n 2.2.3]
[keywords cardinality]
[keywords difference]
[keywords emptiness]
[keywords exclusion]
[keywords inclusion]
[keywords intersection]
[keywords membership]
[keywords set]
[keywords {symmetric difference}]
[keywords union]
[copyright {2004-2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>}]
[moddesc {Tcl Data Structures}]
[titledesc {Procedures for manipulating sets}]
[category {Data structures}]
[require Tcl 8.0]
[require struct::set [opt 2.2.3]]
[description]
[para]
The [cmd ::struct::set] namespace contains several useful commands for
processing finite sets.
[para]
It exports only a single command, [cmd struct::set]. All
functionality provided here can be reached through a subcommand of
this command.
[para]
[emph Note:] As of version 2.2 of this package a critcl based C
implementation is available. This implementation however requires Tcl
8.4 to run.
[section COMMANDS]
[list_begin definitions]
[call [cmd ::struct::set] [method empty] [arg set]]
Returns a boolean value indicating if the [arg set] is
empty ([const true]), or not ([const false]).
[call [cmd ::struct::set] [method size] [arg set]]
Returns an integer number greater than or equal to zero. This is the
number of elements in the [arg set]. In other words, its cardinality.
[call [cmd ::struct::set] [method contains] [arg set] [arg item]]
Returns a boolean value indicating if the [arg set] contains the
element [arg item] ([const true]), or not ([const false]).
[call [cmd ::struct::set] [method union] [opt [arg set1]...]]
Computes the set containing the union of [arg set1], [arg set2],
etc., i.e. "[arg set1] + [arg set2] + ...", and returns this set
as the result of the command.
[call [cmd ::struct::set] [method intersect] [opt [arg set1]...]]
Computes the set containing the intersection of [arg set1],
[arg set2], etc., i.e. "[arg set1] * [arg set2] * ...", and
returns this set as the result of the command.
[call [cmd ::struct::set] [method difference] [arg set1] [arg set2]]
Computes the set containing the difference of [arg set1] and
[arg set2], i.e. ("[arg set1] - [arg set2]") and returns this
set as the result of the command.
[call [cmd ::struct::set] [method symdiff] [arg set1] [arg set2]]
Computes the set containing the symmetric difference of [arg set1] and
[arg set2], i.e. ("([arg set1] - [arg set2]) + ([arg set2] - [arg set1])")
and returns this set as the result of the command.
[call [cmd ::struct::set] [method intersect3] [arg set1] [arg set2]]
This command is a combination of the methods [method intersect] and
[method difference].
It returns a three-element list containing "[arg set1]*[arg set2]",
"[arg set1]-[arg set2]", and "[arg set2]-[arg set1]", in this
order. In other words, the intersection of the two parameter sets, and
their differences.
[call [cmd ::struct::set] [method equal] [arg set1] [arg set2]]
Returns a boolean value indicating if the two sets are equal
([const true]) or not ([const false]).
[call [cmd ::struct::set] [method include] [arg svar] [arg item]]
The element [arg item] is added to the set specified by the variable
name in [arg svar]. The return value of the command is empty. This is
the equivalent of [cmd lappend] for sets. If the variable named by
[arg svar] does not exist it will be created.
[call [cmd ::struct::set] [method exclude] [arg svar] [arg item]]
The element [arg item] is removed from the set specified by the
variable name in [arg svar]. The return value of the command is
empty. This is a near-equivalent of [cmd lreplace] for sets.
[call [cmd ::struct::set] [method add] [arg svar] [arg set]]
All the element of [arg set] are added to the set specified by the
variable name in [arg svar]. The return value of the command is
empty. This is like the method [method include], but for the addition
of a whole set. If the variable named by [arg svar] does not exist it
will be created.
[call [cmd ::struct::set] [method subtract] [arg svar] [arg set]]
All the element of [arg set] are removed from the set specified by the
variable name in [arg svar]. The return value of the command is
empty. This is like the method [method exclude], but for the removal
of a whole set.
[call [cmd ::struct::set] [method subsetof] [arg A] [arg B]]
Returns a boolean value indicating if the set [arg A] is a true
subset of or equal to the set [arg B] ([const true]), or not
([const false]).
[list_end]
[section REFERENCES]
[vset CATEGORY {struct :: set}]
[include ../common-text/feedback.inc]
[manpage_end]
|