Debian Codegraph @

cytoolz/curried/__init__.py

raw
1 """
2 Alternate namespace for cytoolz such that all functions are curried
3
4 Currying provides implicit partial evaluation of all functions
5
6 Example:
7
8 Get usually requires two arguments, an index and a collection
9 >>> from cytoolz.curried import get
10 >>> get(0, ('a', 'b'))
11 'a'
12
13 When we use it in higher order functions we often want to pass a partially
14 evaluated form
15 >>> data = [(1, 2), (11, 22), (111, 222)]
16 >>> list(map(lambda seq: get(0, seq), data))
17 [1, 11, 111]
18
19 The curried version allows simple expression of partial evaluation
20 >>> list(map(get(0), data))
21 [1, 11, 111]
22
23 See Also:
24 cytoolz.functoolz.curry
25 """
26 import cytoolz
27 from . import operator
28 from cytoolz import (
29 apply,
30 comp,
31 complement,
32 compose,
33 compose_left,
34 concat,
35 concatv,
36 count,
37 curry,
38 diff,
39 first,
40 flip,
41 frequencies,
42 identity,
43 interleave,
44 isdistinct,
45 isiterable,
46 juxt,
47 last,
48 memoize,
49 merge_sorted,
50 peek,
51 pipe,
52 second,
53 thread_first,
54 thread_last,
55 )
56 from .exceptions import merge, merge_with
57
58 accumulate = cytoolz.curry(cytoolz.accumulate)
59 assoc = cytoolz.curry(cytoolz.assoc)
60 assoc_in = cytoolz.curry(cytoolz.assoc_in)
61 cons = cytoolz.curry(cytoolz.cons)
62 countby = cytoolz.curry(cytoolz.countby)
63 dissoc = cytoolz.curry(cytoolz.dissoc)
64 do = cytoolz.curry(cytoolz.do)
65 drop = cytoolz.curry(cytoolz.drop)
66 excepts = cytoolz.curry(cytoolz.excepts)
67 filter = cytoolz.curry(cytoolz.filter)
68 get = cytoolz.curry(cytoolz.get)
69 get_in = cytoolz.curry(cytoolz.get_in)
70 groupby = cytoolz.curry(cytoolz.groupby)
71 interpose = cytoolz.curry(cytoolz.interpose)
72 itemfilter = cytoolz.curry(cytoolz.itemfilter)
73 itemmap = cytoolz.curry(cytoolz.itemmap)
74 iterate = cytoolz.curry(cytoolz.iterate)
75 join = cytoolz.curry(cytoolz.join)
76 keyfilter = cytoolz.curry(cytoolz.keyfilter)
77 keymap = cytoolz.curry(cytoolz.keymap)
78 map = cytoolz.curry(cytoolz.map)
79 mapcat = cytoolz.curry(cytoolz.mapcat)
80 nth = cytoolz.curry(cytoolz.nth)
81 partial = cytoolz.curry(cytoolz.partial)
82 partition = cytoolz.curry(cytoolz.partition)
83 partition_all = cytoolz.curry(cytoolz.partition_all)
84 partitionby = cytoolz.curry(cytoolz.partitionby)
85 peekn = cytoolz.curry(cytoolz.peekn)
86 pluck = cytoolz.curry(cytoolz.pluck)
87 random_sample = cytoolz.curry(cytoolz.random_sample)
88 reduce = cytoolz.curry(cytoolz.reduce)
89 reduceby = cytoolz.curry(cytoolz.reduceby)
90 remove = cytoolz.curry(cytoolz.remove)
91 sliding_window = cytoolz.curry(cytoolz.sliding_window)
92 sorted = cytoolz.curry(cytoolz.sorted)
93 tail = cytoolz.curry(cytoolz.tail)
94 take = cytoolz.curry(cytoolz.take)
95 take_nth = cytoolz.curry(cytoolz.take_nth)
96 topk = cytoolz.curry(cytoolz.topk)
97 unique = cytoolz.curry(cytoolz.unique)
98 update_in = cytoolz.curry(cytoolz.update_in)
99 valfilter = cytoolz.curry(cytoolz.valfilter)
100 valmap = cytoolz.curry(cytoolz.valmap)
101
102 del exceptions
103 del cytoolz