aboutsummaryrefslogtreecommitdiff
path: root/doc/pddp/all_about_lists_vs_anythings.pd
blob: 6de84b273262c47d181f2fbbaf45155661e01d5f (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
#N canvas 266 99 873 619 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 488 138 bng 15 250 50 0 empty empty bang 0 20 1 9 -262144 -1
-1;
#X obj 535 138 bng 15 250 50 0 empty empty float 0 21 1 9 -262144 -1
-1;
#X obj 684 138 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 585 138 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.5 $$Date: 2005-07-25 21:33:45 $;
#X text 446 589 $Author: eighthave $;
#X text 673 551 updated for Pd 0.38-2;
#X obj 487 117 route bang float list pointer symbol;
#X obj 635 138 bng 15 250 50 0 empty empty pointer 0 21 1 9 -262144
-1 -1;
#X obj 734 138 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".;
#X obj 11 169 bng 15 250 50 0 empty empty bang 0 20 1 9 -262144 -1
-1;
#X obj 58 169 bng 15 250 50 0 empty empty float 0 21 1 9 -262144 -1
-1;
#X obj 207 169 bng 15 250 50 0 empty empty symbol 0 21 1 9 -262144
-1 -1;
#X obj 108 169 bng 15 250 50 0 empty empty list 0 21 1 9 -262144 -1
-1;
#X obj 10 148 route bang float list pointer symbol;
#X obj 158 169 bng 15 250 50 0 empty empty pointer 0 21 1 9 -262144
-1 -1;
#X obj 257 169 bng 15 250 50 0 empty empty UNDEFINED 0 21 1 9 -262144
-1 -1;
#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 are not general enough to handle this situation.;
#N canvas 0 22 848 498 some 0;
#X obj 176 169 print;
#X msg 137 100 list one two three;
#X msg 122 61 1 2 3;
#X msg 131 80 one 2 three;
#X obj 97 169 route list;
#X obj 97 198 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 165 199 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 124 139 prepend test;
#X text 19 23 [prepend] accepts lists and undefined sets and outputs
undefined sets.;
#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 86 307 list one two three;
#X msg 67 269 1 2 3;
#X msg 77 287 one 2 three;
#X obj 37 401 route list;
#X obj 37 430 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 105 431 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 64 371 prepend list;
#X obj 116 401 print PREPEND;
#X obj 92 351 print STRAIGHT;
#X msg 100 326 list 1 two 3;
#X msg 490 222 list one two three;
#X msg 475 183 1 2 3;
#X msg 484 202 one 2 three;
#X obj 450 291 route list;
#X obj 450 320 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 518 321 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 616 294 route list;
#X obj 616 323 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 684 324 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 221 141 (I used cyclone's);
#X obj 477 261 route one;
#X text 415 127 [route] accepts lists and undefined sets and outputs
lists \, and like [print] only interprets the 'list' selector for implied
lists:;
#X obj 529 291 print ONE;
#X obj 692 294 print NOT_ONE;
#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 10 0 16 0;
#X connect 10 0 18 0;
#X connect 11 0 16 0;
#X connect 11 0 18 0;
#X connect 12 0 16 0;
#X connect 12 0 18 0;
#X connect 13 0 14 0;
#X connect 13 1 15 0;
#X connect 16 0 13 0;
#X connect 16 0 17 0;
#X connect 19 0 18 0;
#X connect 19 0 16 0;
#X connect 20 0 30 0;
#X connect 21 0 30 0;
#X connect 22 0 30 0;
#X connect 23 0 24 0;
#X connect 23 1 25 0;
#X connect 26 0 27 0;
#X connect 26 1 28 0;
#X connect 30 0 23 0;
#X connect 30 0 32 0;
#X connect 30 1 26 0;
#X connect 30 1 33 0;
#X restore 463 466 pd some odd cases of list handling;
#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 56 0;
#X connect 9 0 1 0;
#X connect 10 0 1 0;
#X connect 14 0 38 0;
#X connect 15 0 38 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 56 0;
#X connect 26 0 4 0;
#X connect 26 0 56 0;
#X connect 38 0 11 0;
#X connect 38 1 12 0;
#X connect 38 2 16 0;
#X connect 38 3 39 0;
#X connect 38 4 13 0;
#X connect 38 5 40 0;
#X connect 41 0 42 0;
#X connect 42 0 43 0;
#X connect 44 0 42 0;
#X connect 46 0 42 0;
#X connect 56 0 52 0;
#X connect 56 1 53 0;
#X connect 56 2 55 0;
#X connect 56 3 57 0;
#X connect 56 4 54 0;
#X connect 56 5 58 0;