Re: More on lists and sets

From: paul c <toledobythesea_at_oohay.ac>
Date: Wed, 22 Mar 2006 16:09:10 GMT
Message-ID: <GEeUf.170811$sa3.12412_at_pd7tw1no>


vc wrote:
> 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]
> ...

Thanks, vc. I take it that the 'usual' intersection operation isn't commutative.

I was sort of expecting, without any hard reason, that any logical answer would preserve not only the ordering but also the adjacency of the list 'elements' which would make your first example's answer 'undefined' (unless there is some list analogy of the empty set) and make the second example's answer perhaps [1,2], ie., what list can I state that is true of both operands.

pc

>
> This:
>
> 1->2->1 /\ 2->1->2 = > 2->1->1->2
>
> does not make any obvious sense.
>
>
>
>

>>pc

>
>
Received on Wed Mar 22 2006 - 17:09:10 CET

Original text of this message