foldr solution to twine!