rev: release-0.15 scopes/doc/module-itertools.rst -rw-r--r-- 1.5 KiB View raw Log this file
e53de6d7cb89 — Leonard Ritter * win32 build fix 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
itertools
=========

itertools provides various utilities which simplify the composition of
generators and collectors.

.. define:: drain

   A constant of type `Collector`.
.. inline:: (->> generator collector...)
.. inline:: (cascade collector...)
   
   two collectors:
   every time a is full, b collects a and a is reset
   when b ends, the remainder of a is collected
.. inline:: (cat coll)
   
   treat input as a generator and forward its arguments individually
.. inline:: (collect coll)
   
   run collector until full and return the result
.. inline:: (demux init-value f collector...)
.. inline:: (each generator collector)
   
   fold output from generator into collector
.. inline:: (filter f coll)
.. inline:: (flatten coll)
   
   collect variadic input as individual single items
.. inline:: (gate f a b)
   
   if f is true, collect input in a, otherwise collect in b
   when both are full, output both
   until then, new input for full containers is discarded
.. inline:: (imap gen f)
.. inline:: (limit f coll)
.. inline:: (map f coll)
.. inline:: (mux collector...)
   
   send input into multiple collectors which each fork the target collector
.. inline:: (mux1 c1 c2 coll)
   
   send input into two collectors which fork the target collector
.. inline:: (reduce init f)
.. inline:: (take n coll)
   
   limit collector to output n items
.. spice:: (compose ...)
.. spice:: (span ...)
.. spice:: (unpack-bitdim ...)
.. spice:: (unpack-dim ...)
.. spice:: (zip ...)