Re: Standard Library report: List union

2002-03-17 Thread Jon Fairbairn
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

RE: Standard Library report: List union

2002-03-11 Thread Simon Peyton-Jones
| 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

Standard Library report: List union

2002-03-04 Thread Jon Fairbairn
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

Re: Standard Library report: List union

2002-03-04 Thread Jay Cox
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