Thomas ten Cate wrote:
Possible, yes.Efficient, not really.inTwain = foldr (\x (ls, rs) -> if length ls == length rs then (x:ls, rs) else (x:(init ls), (last ls):rs)) ([], [])
But this uses length and init and last all of which are recursive functions. I consider that cheating: only foldr may do the recursion.
Martijn. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
