aboutsummaryrefslogtreecommitdiff
path: root/externals/gridflow/doc/flow_classes/#fold-help.pd
blob: 0120aad910d02c19f7cb509e20b4034e8b4e82b2 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#N canvas 678 0 632 661 10;
#X obj 98 184 display;
#X obj 29 252 display;
#X text 26 38 Treats the grid as a grid of one- dimensional grids such
that the same operation (here addition) will be performed on all its
elements together with the base value. the results are combined back.
each #fold operation removes a dimension. syntax: #fold <two-input
operation> <starting value>;
#X obj 143 249 #to_float;
#X obj 143 274 print values;
#X text 6 721 some other forms:;
#X obj 140 722 #fold *;
#X obj 17 695 #fold + \, seed 0;
#X obj 211 722 #fold ^;
#X obj 284 722 #fold &;
#X obj 355 722 #fold |;
#N canvas 0 0 500 313 more 1;
#X obj 98 82 display;
#X obj 28 48 #import (2 2 2);
#X obj 29 170 display;
#X msg 28 27 1 3 1 3 1 3 1 5;
#X text 154 24 <-- clicking here creates a grid through [#import];
#X obj 122 170 #to_float;
#X obj 122 195 print values;
#X obj 28 137 #fold + \, seed (0 0);
#X connect 1 0 0 0;
#X connect 1 0 7 0;
#X connect 3 0 1 0;
#X connect 5 0 6 0;
#X connect 7 0 2 0;
#X connect 7 0 5 0;
#X restore 160 694 pd more info;
#X msg 28 129 1 3 1 3 1 3 1 3 1 3 1 5;
#X obj 28 153 #import (2 3 2);
#X obj 28 224 #fold +;
#X text 203 129 <-- clicking here creates a grid through [#import]
;
#X obj 3 324 doc_c 1;
#X obj 3 386 doc_i 1;
#X obj 3 570 doc_o 1;
#X obj 0 0 doc_h;
#X obj 14 600 doc_oo 0;
#X obj 14 416 doc_ii 0;
#X obj 14 354 doc_cc 0;
#X text 219 155 [#fold +] computes totals;
#X text 221 176 [#fold inv+] is an alternated sum (+/-);
#X text 225 203 [#fold *] can compute the size of a grid using its
dimension list;
#X text 229 240 [#fold &] can mean "for all";
#X text 228 260 [#fold |] can mean "there exists (at least one)";
#X text 224 282 [#fold ^] can mean "there exists an odd number of..."
;
#X obj 97 354 doc_m c0 symbol/numop;
#X text 232 354 the operator to fold with.;
#X obj 97 416 doc_m i0 grid;
#X obj 97 477 doc_m i0 op;
#X obj 97 499 doc_m i0 seed;
#X text 232 477 same as arg 0;
#X text 232 416 replaces every subgrid by the result of a cascade on
that subgrid. Doing that with seed value 0 and operation + on grid
"2 3 5 7" will compute ((((0+2)+3)+5)+7) find the total "17".;
#X text 232 499 the initial value for the folding. (default: whatever
does nothing for the chosen op \; e.g. 0 + \, 0 - \, 1 * \, ...). this
can be a grid of any size \, and this decides the size of the subgrids
we are working on.;
#X obj 97 600 doc_m o0 grid;
#X text 232 600 Outputs a grid that has one less dimension than the
input.;
#X obj 0 632 doc_f;
#X connect 3 0 4 0;
#X connect 12 0 13 0;
#X connect 13 0 0 0;
#X connect 13 0 14 0;
#X connect 14 0 1 0;
#X connect 14 0 3 0;
#X connect 29 1 30 0;
#X connect 31 1 35 0;
#X connect 32 1 34 0;
#X connect 33 1 36 0;
#X connect 37 1 38 0;