aboutsummaryrefslogtreecommitdiff
path: root/doc/pddp/all_about_lists_vs_anythings.pd
blob: 7e9a6440432a46b46edc33bab0fd594140b777cc (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#N canvas 268 58 889 635 10;
#X msg 95 298 1 2 3;
#X obj 125 329 route list;
#X msg 62 278 list 1 2 3;
#X msg 10 63 list;
#X symbolatom 32 129 10 0 0 0 - - -;
#X obj 4 2 cnv 15 850 20 empty empty all_about_lists_vs_anythings 20
10 1 18 -233017 -66577 0;
#X text 7 39 SPECIAL CASES OF "LISTS".;
#X obj 125 348 bng 15 250 50 0 empty empty list -20 7 1 10 -262144
-1 -1;
#X obj 189 349 bng 15 250 50 0 empty empty non-list 19 7 1 10 -262144
-1 -1;
#X msg 184 277 list this is a set with a cast;
#X msg 191 296 this is a set withOUT a cast;
#X obj 484 135 bng 15 250 50 0 empty empty bang 0 20 1 9 -262144 -1
-1;
#X obj 533 135 bng 15 250 50 0 empty empty float 0 21 1 9 -262144 -1
-1;
#X obj 582 135 bng 15 250 50 0 empty empty symbol 0 21 1 9 -262144
-1 -1;
#X msg 486 73 list this is a set with a cast;
#X msg 493 92 this is a set withOUT a cast;
#X obj 681 135 bng 15 250 50 0 empty empty list 0 21 1 9 -262144 -1
-1;
#X obj 120 527 route list;
#X obj 120 546 bng 15 250 50 0 empty empty list -20 7 1 10 -262144
-1 -1;
#X obj 184 547 bng 15 250 50 0 empty empty non-list 19 7 1 10 -262144
-1 -1;
#X msg 189 491 one 2 three 4 five;
#X msg 40 491 1 two 3 four 5;
#X text 8 198 IMPLICIT LISTS;
#X msg 40 471 list 1 two 3 four 5;
#X msg 189 471 list one 2 three 4 five;
#X msg 17 83 list 25;
#X msg 24 103 list foo;
#X text 87 104 A "list" of one "symbol" is converted to a "symbol"
;
#X text 72 83 A "list" of one "float" is converted to a "float";
#X text 50 63 An empty "list" is converted to a "bang";
#X obj 520 514 pddp_open all_about_atom_conversion;
#X obj 821 3 pddp;
#X text 11 400 Sets of mixed atoms are defined based on what the "selector"
(the first element of a set). If the "selector" is a "float" \, then
the set is a "list". If the "selector" is the word "list" \, then the
set is a "list". If the "selector" is a "symbol" \, then the set is
NOT a "list":;
#X text 22 575 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at>
;
#X text 239 589 released under the GNU GPL;
#X text 445 576 $Revision: 1.8 $$Date: 2006-02-06 04:31:31 $;
#X text 446 589 $Author: matju $;
#X text 673 551 updated for Pd 0.38-2;
#X obj 731 135 bng 15 250 50 0 empty empty UNDEFINED 0 21 1 9 -262144
-1 -1;
#X msg 502 286 1 1;
#X obj 495 312 +;
#X floatatom 495 334 5 0 0 0 - - -;
#X msg 467 286 1 3;
#X text 459 46 A set that is not a "list" has an undefined type:;
#X msg 494 267 list 1 2;
#X text 445 208 If you send a "list" of arguments to the first inlet
of an object \, the elements of that "list" will be applied to the
respective inlet. This does not apply to sets that are NOT "lists".
;
#X text 443 192 "LISTS" MAP TO INLETS;
#X text 450 367 WORKING WITH MIXED SETS;
#X text 11 381 SETS OF MIXED "ATOMS";
#X text 9 218 A message having more than one atom starting with a "float"
is implicitly considered a list. A message having more than one atom
starting with a "symbol" is not \, unless that "symbol" is the selector
"list".;
#N canvas 183 32 857 475 has 0;
#X obj 96 162 print;
#X msg 57 93 list one two three;
#X msg 42 54 1 2 3;
#X msg 51 73 one 2 three;
#X obj 17 162 route list;
#X obj 17 181 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 85 182 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 44 132 prepend test;
#X text 12 229 [print] only interprets the "list" selector when the
following body of the message is an implied list \, i.e. a set of atoms
that starts with a float.;
#X msg 443 68 one 2 three;
#X text 141 134 (I used cyclone's);
#X obj 442 127 route one;
#X text 426 17 [route] accepts lists and undefined sets and outputs
lists \, and like [print] only interprets the 'list' selector for implied
lists:;
#X obj 460 159 print ONE;
#X obj 441 159 bng 16 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 604 159 bng 16 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 668 160 print ONE;
#X obj 650 160 bng 16 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 813 160 bng 16 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 651 129 route 1;
#X msg 658 90 list 1 two 3;
#X msg 652 70 1 two 3;
#X msg 449 88 list one 2 three;
#X msg 281 68 one 2 three;
#X obj 280 133 prepend list;
#X obj 280 177 print PREPEND_LIST;
#X msg 290 89 list one 2 three;
#X text 12 19 [prepend] interprets lists and outputs undefined sets.
;
#X obj 746 160 print NOT;
#X obj 536 159 print NOT;
#X msg 679 305 symbol test;
#X obj 685 359 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 762 360 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 677 398 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 755 398 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 685 341 route symbol;
#X obj 677 379 route symbol;
#X msg 770 305 test;
#X obj 470 359 route list;
#X obj 470 378 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 538 379 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 457 397 route list;
#X obj 457 416 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 525 417 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X msg 473 310 list 1 two 3;
#X msg 456 290 1 two 3;
#X msg 489 330 list one 2 three;
#X msg 133 330 one 2 three;
#X obj 65 414 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 133 415 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 151 390 print STRAIGHT;
#X msg 117 310 list 1 two 3;
#X msg 100 290 1 two 3;
#X msg 142 351 list one 2 three;
#X obj 68 391 route list;
#X text 429 231 [route list] interprets all lists \, but outputs non-lists
on its left outlet for lists whose first element is a symbol. [route
symbol] outputs a symbol from its left outlet.;
#X connect 1 0 7 0;
#X connect 2 0 7 0;
#X connect 3 0 7 0;
#X connect 4 0 5 0;
#X connect 4 1 6 0;
#X connect 7 0 0 0;
#X connect 7 0 4 0;
#X connect 9 0 11 0;
#X connect 11 0 13 0;
#X connect 11 0 14 0;
#X connect 11 1 15 0;
#X connect 11 1 29 0;
#X connect 19 0 16 0;
#X connect 19 0 17 0;
#X connect 19 1 18 0;
#X connect 19 1 28 0;
#X connect 20 0 19 0;
#X connect 21 0 19 0;
#X connect 22 0 11 0;
#X connect 23 0 24 0;
#X connect 24 0 25 0;
#X connect 26 0 24 0;
#X connect 30 0 35 0;
#X connect 35 0 31 0;
#X connect 35 0 36 0;
#X connect 35 1 32 0;
#X connect 36 0 33 0;
#X connect 36 1 34 0;
#X connect 37 0 35 0;
#X connect 38 0 39 0;
#X connect 38 0 41 0;
#X connect 38 1 40 0;
#X connect 41 0 42 0;
#X connect 41 1 43 0;
#X connect 44 0 38 0;
#X connect 45 0 38 0;
#X connect 46 0 38 0;
#X connect 47 0 50 0;
#X connect 47 0 54 0;
#X connect 51 0 50 0;
#X connect 51 0 54 0;
#X connect 52 0 50 0;
#X connect 52 0 54 0;
#X connect 53 0 50 0;
#X connect 53 0 54 0;
#X connect 54 0 48 0;
#X connect 54 1 49 0;
#X restore 486 453 pd has some odd cases of list handling;
#X text 450 389 When working with sets that might be either "lists"
or undefined \, use [prepend]. Many of the "list" handling objects
in Pd have odd quirks which can make things difficult.;
#X obj 484 115 route bang float symbol pointer list;
#X obj 632 135 bng 15 250 50 0 empty empty pointer 0 21 1 9 -262144
-1 -1;
#X obj 11 169 bng 15 250 50 0 empty empty bang 0 20 1 9 -262144 -1
-1;
#X obj 60 169 bng 15 250 50 0 empty empty float 0 21 1 9 -262144 -1
-1;
#X obj 109 169 bng 15 250 50 0 empty empty symbol 0 21 1 9 -262144
-1 -1;
#X obj 208 169 bng 15 250 50 0 empty empty list 0 21 1 9 -262144 -1
-1;
#X obj 258 169 bng 15 250 50 0 empty empty UNDEFINED 0 21 1 9 -262144
-1 -1;
#X obj 11 149 route bang float symbol pointer list;
#X obj 159 169 bng 15 250 50 0 empty empty pointer 0 21 1 9 -262144
-1 -1;
#X connect 0 0 1 0;
#X connect 1 0 7 0;
#X connect 1 1 8 0;
#X connect 2 0 1 0;
#X connect 3 0 59 0;
#X connect 9 0 1 0;
#X connect 10 0 1 0;
#X connect 14 0 52 0;
#X connect 15 0 52 0;
#X connect 17 0 18 0;
#X connect 17 1 19 0;
#X connect 20 0 17 0;
#X connect 21 0 17 0;
#X connect 23 0 17 0;
#X connect 24 0 17 0;
#X connect 25 0 59 0;
#X connect 26 0 4 0;
#X connect 26 0 59 0;
#X connect 39 0 40 0;
#X connect 40 0 41 0;
#X connect 42 0 40 0;
#X connect 44 0 40 0;
#X connect 52 0 11 0;
#X connect 52 1 12 0;
#X connect 52 2 13 0;
#X connect 52 3 53 0;
#X connect 52 4 16 0;
#X connect 52 5 38 0;
#X connect 59 0 54 0;
#X connect 59 1 55 0;
#X connect 59 2 56 0;
#X connect 59 3 60 0;
#X connect 59 4 57 0;
#X connect 59 5 58 0;