Terrence Brannon wrote at Tue, 02 Jul 2002 21:58:51 +0200: >> A list doesn't stand for any fixed implementation. A list can be regarded as >> - an array > > an array is a standard perl data structure defined as a list with a name. Example: > > @A = (1,2,3);
Right. I thought more to the general thinking of lists (from a computer science/linguistic view). Allthough what I really thought was the word "Collection". However, it seems to be more common to me to think, that a list can represent a set or something else, too. But perhaps it's better to implement these ideas in a module like Collection::Compare. > > we have a list ( 1, 2, 3) which has a name (@A) > >> - a set > > hmm, sets can't have repeating elements, right? thus lists are not as restricted wrt >contents as a > set. Year. Comparing two lists as sets should ignore double elements. It's like: my @A; my @B; # both Arrays my $set_A = Set::Scalar->new(@A); # makes a real set my $set_B = Set::Scalar->new(@B); # make elements uniq $set_A->is_eqal($set_B); what I sometimes would prefer to write: are_equal_sets( \@A, \@B ); >> - a bag (multiset) > > I have forgotten what a bag is. Anyone mind explaining? > A bag is a "set" where elements can occur more than one times. Two bags are equal iff they have equal elements, the occurences of each element is the same in both bags. So a set {1} = {1, 1} = {1, 1, 1} = ..., while <1> != <1, 1> != <1, 1, 1>. Greetings, Janek