def _sequence_map(smap, *seqs):
    """Structural map on a sequence (list, tuple, etc.)."""
    s0 = seqs[0]
    t = type(s0)
    # Each sequence must have the same type and the same length.
    smap.require_same([type, len], seqs)
    return t(smap(*[s[i] for s in seqs]) for i in range(len(s0)))