Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> comp.databases.theory -> Re: More on lists and sets
vc wrote:
> paul c wrote:
>
> 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]
You speak as if "list intersection" is a well-defined, well-understood term with no significant disagreement. I am sure there are some contexts where that is so, but this newsgroup would not be one of them.
Anyway, usual or not, I find this definition unappealing because it is not commutative, (and in fact treats the second operand as a set, and so should better be called list-set intersection) and because it has elements from the left list ending up at positions that are not locally related to their original position. (That is, you have to examine the entirety of bot operands to know where any one element will end up.)
This seems to me more like an imperative operator than a functional one.
Marshall Received on Sun Mar 26 2006 - 20:50:58 CST