def glue(stdin, delimiter=" "):
    """
    Join every lines in the stream, using the given delimiter.
    The default delimiter is a space.

    >>> list([[[1], [2]], [[3], [4]], [[5], [6]]] |
    ...      traverse() | map(str) | glue(" "))
    ['1 2 3 4 5 6']
    """
    data = list(stdin)
    return iter([delimiter.join(data)])