[Haskell-cafe] A small puzzle: inTwain as function of foldr

Martijn van Steenbergen martijn at van.steenbergen.nl
Thu Jun 4 10:22:30 EDT 2009


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?

Is there a general way to tell if a problem can be expressed as a fold?

Thank you,

Martijn.


More information about the Haskell-Cafe mailing list