Extended predicate/mapper semantics

Many of funcy functions expecting predicate or mapping function as an argument can take something uncallable instead of it with semantics described in this table:

f passed Predicate Mapping function
None bool identity
string re_tester(f) re_finder(f)
int or slice itemgetter(f) itemgetter(f)
mapping f.get f.get
set lambda x: x in f lambda x: x in f

Supporting functions

Here is a full list of functions supporting extended predicate/mapper semantics:

Group Functions
Sequence transformation map(), imap(), keep(), ikeep(), mapcat(), imapcat()
Sequence filtering filter(), ifilter(), remove(), iremove(), distinct(), idistinct()
Sequence splitting dropwhile(), takewhile(), split(), split_by()
Sequence chunking group_by(), count_by(), partition_by(), ipartition_by()
Collection transformation walk(), walk_keys(), walk_values()
Collection filtering select(), select_keys(), select_values()
Content tests all(), any(), none(), one(), some(), is_distinct()
Function logic all_fn(), any_fn(), none_fn(), one_fn(), some_fn()
Function tools compose(), complement(), juxt(), ijuxt()

Table Of Contents

Previous topic

Python 3 support

Next topic

Sequences

This Page