in reply to Set Notation Handling
use Set::Scalar; $s = Set::Scalar->new; $s->insert('a', 'b'); $s->delete('b'); $t = Set::Scalar->new('x', 'y', $z); $u = $s->union($t); $i = $s->intersection($t); $d = $s->difference($t); $e = $s->symmetric_difference($t); $v = $s->unique($t); $c = $s->complement;
From your other post, however, it seems like you are interested in a more specialized form of set, that is integer ranges or spans. In this case, check out the module Set::IntSpan:
For large integral ranges, Set::IntSpan can be a lot more efficient than Set::Scalar.use Set::IntSpan qw(grep_set map_set); $set_spec = "1-20000"; $set = new Set::IntSpan $set_spec; $set_spec = "1-14192,14194,14196-14221"; $u_set = union $set $set_spec; $i_set = intersect $set $set_spec; $x_set = xor $set $set_spec; $d_set = diff $set $set_spec; $c_set = complement $set;
-Mark
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Set Notation Handling
by tradez (Pilgrim) on Mar 28, 2005 at 22:28 UTC | |
by tall_man (Parson) on Mar 28, 2005 at 23:37 UTC | |
by tradez (Pilgrim) on Mar 29, 2005 at 15:35 UTC |