"Bas van Dijk" <[EMAIL PROTECTED]> writes:

>   weave [[1,1,1], [2,2,2], [3,3]] ==> [1,2,3,1,2,3,1,2]
>   weave [[1,1,1], [2,2], [3,3,3]] ==> [1,2,3,1,2,3,1]
>
> Note that 'weave' stops when a list is empty.

My naive implementation is,

weave [] = []
weave ([]:_) = []
weave (x:xs) = head x : weave (xs ++ [tail x])

It's at least brief!

-- Mark

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to