[ ghc-Bugs-435234 ] nubBy flips args to nubbing function
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 25 Jun 2001 07:57:09 -0700
Bugs item #435234, was opened at 2001-06-21 14:52
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=435234&group_id=8032
Category: None
Group: 5.00
>Status: Closed
>Resolution: Remind
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: nubBy flips args to nubbing function
Initial Comment:
The nubBy function in the List library seems to flip
the order of arguments to the nubbing function from
that specified in the prelude:
nubBy eq (x:xs) = x : nubBy eq (filter (\y ->
not (eq x y)) xs)
I.e., it seems to use (eq y x) instead of (eq x y).
This doesn't matter of course for symmetric nubbing
functions, but I just tried to use it with the
following function:
subsetEq :: (Eq a) => [a] -> [a] -> Bool
subsetEq l1 l2 = all (`elem` l2) l1
> nubBy subsetEq [[1],[1,2],[2,3],[2]]
[[1],[1,2],[2,3]]
> nubBy (flip subsetEq) [[1],[1,2],[2,3],[2]]
[[1],[2,3],[2]]
----------------------------------------------------------------------
>Comment By: Simon Peyton Jones (simonpj)
Date: 2001-06-25 07:57
Message:
Logged In: YES
user_id=50165
Readily fixed. Thanks.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=435234&group_id=8032