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))
def formatwith(fmt): return postfix(partial( format, format_spec=fmt)) # postfix(lambda x:format(x, fmt))
def lfilterwith(function): """ @see filterwith """ return postfix(lambda *iterables: lfilter(function, *iterables))
def lmapwith(function): """ @see mapwith """ return postfix(lambda *iterables: lmap(function, *iterables))
def filterwith(function): return postfix(lambda *iterables: filter(function, *iterables))