On Fri, Sep 10, 2010 at 1:06 AM, Nils Schweinsberg
<ml@n-sch.de> wrote:
Something like this?
import Data.List
newList :: Int -> [[Int]]
newList n = myNub
[ l | l <- undefined -- not really sure how you want
-- to generate these lists :)
, sum l == sum [1..n]
]
myNub :: (Ord a) => [[a]] -> [[a]]
myNub = nubBy (\a b -> sort a == sort b)
- Nils
So I've checked out this code, and it doesn't compile on ghci. My version, without the "undefined" portion is(which still doesn't work):
import Data.List
newList :: Int -> [[Int]]
newList n = myNub [ l | l <- [1..n], sum l == sum [1..n] ]
myNub :: (Ord a) => [[a]] -> [[a]]
myNub = nubBy (\a b -> sort a == sort b)
Maybe there's something in the syntax that I'm not quite getting...
\/\/