On Thu, Jun 4, 2009 at 4:22 PM, Martijn van Steenbergen <[email protected]> wrote: > Bonjour café, > > A small puzzle: > > Consider the function inTwain that splits a list of even length evenly into > two sublists: > >> inTwain "Hello world!" > ("Hello ","world!") > > Is it possible to implement inTwain such that the recursion is done by one > of the standard list folds?
I don't think it is without a length before at least. On the other hand if your specification is just "splits a list of even length evenly into two sublists", you can contrive something with a simple foldr : inTwain = foldr (\x ~(xs,ys) -> (ys, x:xs)) ([],[]) -- Jedaï _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
