in reply to Relationships of Matching Sets
Given the set objects, you can perfom various operation on the sets to derive relations:use Set::Scalar; $s = Set::Scalar->new; $s->insert('a', 'b'); $s->delete('b'); $t = Set::Scalar->new('x', 'y', $z);
difference can be used to test for subsets and symmetric difference can be used as a kind of distance metric.$u = $s->union($t); $i = $s->intersection($t); $d = $s->difference($t); $e = $s->symmetric_difference($t); $v = $s->unique($t); $c = $s->complement;
Update: fixed a typo.
-Mark
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Relationships of Matching Sets
by biosysadmin (Deacon) on Dec 17, 2004 at 01:48 UTC |