Exemplo n.º 1
0
def mapwith(function):
    """
    >>> sum(map(int, '1 2 7 2'.split()))
    12
    >>> toints = mapwith(int)
    >>> sum(toints('1 2 7 2'.split()))
    12
    >>> '1 2 7 2'.split() |mapwith(int) |postfix(sum)
    12
    """
    return postfix(lambda *iterables: map(function, *iterables))
Exemplo n.º 2
0
def formatwith(fmt):
    return postfix(partial(
        format, format_spec=fmt))  # postfix(lambda x:format(x, fmt))
Exemplo n.º 3
0
def lfilterwith(function):
    """ @see filterwith """
    return postfix(lambda *iterables: lfilter(function, *iterables))
Exemplo n.º 4
0
def lmapwith(function):
    """ @see mapwith """
    return postfix(lambda *iterables: lmap(function, *iterables))
Exemplo n.º 5
0
def filterwith(function):
    return postfix(lambda *iterables: filter(function, *iterables))