Steve Schafer writes (in the Haskell Cafe):

I have a list of integers, e.g.:

[1,5,3,17,8,9]

I want to split it into a pair of lists, with the criterion being that
the sum of the elements in the first list is as large as possible, but
not exceeding a threshold value. For example, if the threshold is 10,
the result should be:

([1,5,3],[17,8,9])

and then I want to recursively apply this process to the remainder of
the list, with the end result being a list of lists of integers. Using
the same list along with a threshold of 18, I would get:

[[1,5,3],[17],[8,9]]

I would get


[[1,5,3], [17], [8,9], [], [], [] ..]


Cheers,


Ronny Wichers Schreur
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to