[Haskell-cafe] How to take a minimum sub list that only contain certain number of elements of certain type?

Gwern Branwen gwern0 at gmail.com
Wed Sep 26 02:59:28 CEST 2012


On Tue, Sep 25, 2012 at 8:45 PM, Richard O'Keefe <ok at cs.otago.ac.nz> wrote:
> That doesn't work either.  Consider the list [1,1,1,1,1].
> The element just after the 5th odd number in the list is 1;
> takeWhile (/= 1) will thus return [] instead of [1,1,1,1].

I'm not sure that OP would prefer [1,1,1,1] to []. Another area of
underspecification.

-- 
gwern
http://www.gwern.net



More information about the Haskell-Cafe mailing list