Re: More on lists and sets
Date: 22 Mar 2006 07:15:34 -0800
Message-ID: <1143040534.267722.315990_at_t31g2000cwb.googlegroups.com>
paul c wrote:
> Mikito Harakiri wrote:
> > ...
> > Definition. List intersection is a cartesian product with equijoin of
> > the list nodes and lexicographic order. Example: 1->2->1 /\ 2->1->2 =
> > 2->1->1->2
> > ...
>
> I'm struggling with the definition. If 1 and 2 stand for nodes, aren't
> the two lists circular? If that's so, aren't there multiple answers?
> (or one answer comprising two lists?)
>
The usual list intersection opeartion (L = L1 intersect L2) is defined
as
L = [x | x <- L1, x in L2]
that is, L retains the elements of L1, in their original order, that
are present in L2.
E.g. [1, 2, 2, 3, 4, 4] intersect [2,4] => [2,2,4,4]
or
[1,2,1] intersect [2,1,1,2] => [1,2,1]
This:
1->2->1 /\ 2->1->2 = > 2->1->1->2
does not make any obvious sense.
> pc
Received on Wed Mar 22 2006 - 16:15:34 CET