There's a remark at the beginning of 7.2 that says:
delete, (\\), union and intersect preserve the invariant=20
that lists don't contain duplicates, provided that=20
their first argument contains no duplicates.
The same applies to unionBy etc. This design is one
you might reasonably
| To: Jon Fairbairn
| Cc: [EMAIL PROTECTED]
| Subject: Re: Standard Library report: List union
|
|
| On Mon, 4 Mar 2002, Jon Fairbairn wrote:
|
| The current library report defines unionBy like this:
|
|unionBy eq xs ys = xs ++ deleteFirstsBy eq (nubBy eq ys) xs
|
| why does it take
The current library report defines unionBy like this:
unionBy eq xs ys = xs ++ deleteFirstsBy eq (nubBy eq ys) xs
why does it take the nub of ys, but not xs? I'd have expected
unionBy eq xs ys = (nubBy eq xs) ++ deleteFirstsBy eq (nubBy eq ys) xs
Jón
--
Jón Fairbairn
On Mon, 4 Mar 2002, Jon Fairbairn wrote:
The current library report defines unionBy like this:
unionBy eq xs ys = xs ++ deleteFirstsBy eq (nubBy eq ys) xs
why does it take the nub of ys, but not xs? I'd have expected
unionBy eq xs ys = (nubBy eq xs) ++ deleteFirstsBy eq (nubBy eq