Re: More on lists and sets
Date: 27 Mar 2006 05:59:52 -0800
Message-ID: <1143467991.957597.163880_at_z34g2000cwc.googlegroups.com>
Marshall Spight wrote:
> 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.
It's been so defined and understood starting at least with Lisp as well as in languages like Scheme, Haskell and ML.
> I am sure there are some
> contexts where that is so, but this newsgroup would not be one
> of them.
Well, knowning prior usage patterns and associated terminology is a matter of [self]education, no ?
>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)
One of course is free to use one's private vocabulary, but it would be hardly productive wouldn't it.
>This seems to me more like an imperative operator than a
>functional one
That's a trivial observation. Any declarative statement can be interpreted 'imperatively'. Received on Mon Mar 27 2006 - 15:59:52 CEST