From 897c69a165df7072806f95db2d6f5fad35a60876 Mon Sep 17 00:00:00 2001 From: Luke Iannini Date: Sat, 25 Apr 2009 05:07:28 +0000 Subject: list-grow is a different manifestation of list-extend that more closely matches how i usually end up using list-extend, list-part and list-part2 are two stabs at allowing lists of lists to be serialized with delimiters (seeds of a library for serializing data-structures into sssad) svn path=/trunk/abstractions/sfruit/; revision=11139 --- sfruit/list-grow-help.pd | 26 ++++++++++++++ sfruit/list-grow.pd | 36 +++++++++++++++++++ sfruit/list-part.pd | 24 +++++++++++++ sfruit/list-part2.pd | 92 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 178 insertions(+) create mode 100644 sfruit/list-grow-help.pd create mode 100644 sfruit/list-grow.pd create mode 100644 sfruit/list-part.pd create mode 100644 sfruit/list-part2.pd diff --git a/sfruit/list-grow-help.pd b/sfruit/list-grow-help.pd new file mode 100644 index 0000000..2c92c82 --- /dev/null +++ b/sfruit/list-grow-help.pd @@ -0,0 +1,26 @@ +#N canvas 0 22 428 331 10; +#X text 44 22 [list-grow] grow a list by appending each new item in +the right inlet to all previous items in the right inlet. Bang the +left inlet to output the grown list and clear the object.; +#X obj 119 182 list-grow; +#X msg 172 131 a; +#X msg 206 139 b; +#X msg 205 166 fcd; +#X msg 213 213 x y; +#X obj 48 140 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X msg 48 102 clear; +#X text 86 101 to clear without output; +#X obj 119 249 prepent set; +#X text 252 155 1: click these a few times; +#X text 10 160 2: click to output; +#X msg 119 290; +#X text 301 304 2009 Luke Iannini; +#X connect 1 0 9 0; +#X connect 2 0 1 1; +#X connect 3 0 1 1; +#X connect 4 0 1 1; +#X connect 5 0 1 1; +#X connect 6 0 1 0; +#X connect 7 0 1 0; +#X connect 9 0 12 0; diff --git a/sfruit/list-grow.pd b/sfruit/list-grow.pd new file mode 100644 index 0000000..8777492 --- /dev/null +++ b/sfruit/list-grow.pd @@ -0,0 +1,36 @@ +#N canvas 62 84 450 300 10; +#X obj 80 40 inlet; +#X obj 248 208 outlet; +#X obj 248 39 inlet; +#X obj 248 114 list prepend; +#X obj 248 177 spigot; +#X obj 80 77 route clear; +#X msg 182 142 1; +#X msg 143 142 0; +#X obj 362 67 == 0; +#X obj 317 63 t a; +#X obj 317 92 spigot 1; +#X obj 286 39 t b; +#X text 43 225 this is an attempt at avoiding unnecessary list copies +a la mathieu's fast list-drip (but i don't actually remember if that +was the mechanism for speed : )) oh well \, hopefully it's fast; +#X obj 143 118 t b b b b; +#X connect 0 0 5 0; +#X connect 2 0 3 0; +#X connect 3 0 4 0; +#X connect 3 0 9 0; +#X connect 4 0 1 0; +#X connect 5 0 11 0; +#X connect 5 1 13 0; +#X connect 6 0 4 1; +#X connect 6 0 8 0; +#X connect 7 0 4 1; +#X connect 7 0 8 0; +#X connect 8 0 10 1; +#X connect 9 0 10 0; +#X connect 10 0 3 1; +#X connect 11 0 3 1; +#X connect 13 0 11 0; +#X connect 13 1 7 0; +#X connect 13 2 3 0; +#X connect 13 3 6 0; diff --git a/sfruit/list-part.pd b/sfruit/list-part.pd new file mode 100644 index 0000000..d194b6e --- /dev/null +++ b/sfruit/list-part.pd @@ -0,0 +1,24 @@ +#N canvas 59 429 450 300 10; +#X obj 123 127 list-find; +#X obj 123 84 list append \$1; +#X obj 123 14 inlet; +#X obj 123 156 once; +#X obj 123 47 t b a b a; +#X obj 124 229 list split; +#X obj 124 204 list; +#X obj 124 178 t b a; +#X obj 124 273 outlet; +#X obj 195 269 outlet; +#X connect 0 0 3 0; +#X connect 1 0 0 0; +#X connect 2 0 4 0; +#X connect 3 0 7 0; +#X connect 4 0 1 0; +#X connect 4 1 0 1; +#X connect 4 2 3 1; +#X connect 4 3 6 1; +#X connect 5 0 8 0; +#X connect 5 1 9 0; +#X connect 6 0 5 0; +#X connect 7 0 6 0; +#X connect 7 1 5 1; diff --git a/sfruit/list-part2.pd b/sfruit/list-part2.pd new file mode 100644 index 0000000..7fe97df --- /dev/null +++ b/sfruit/list-part2.pd @@ -0,0 +1,92 @@ +#N canvas 253 257 481 530 10; +#X obj 123 127 list-find; +#X obj 123 84 list append \$1; +#X obj 123 14 inlet; +#X obj 124 384 list; +#X obj 124 358 t b a; +#X obj 124 453 outlet; +#N canvas 0 22 450 300 list-grow 0; +#X obj 80 40 inlet; +#X obj 248 208 outlet; +#X obj 248 39 inlet; +#X obj 248 114 list prepend; +#X obj 248 177 spigot; +#X obj 80 77 route clear; +#X msg 182 142 1; +#X msg 143 142 0; +#X obj 362 67 == 0; +#X obj 317 63 t a; +#X obj 317 92 spigot 1; +#X obj 286 39 t b; +#X obj 143 118 t b b b b; +#X connect 0 0 5 0; +#X connect 2 0 3 0; +#X connect 3 0 4 0; +#X connect 3 0 9 0; +#X connect 4 0 1 0; +#X connect 5 0 11 0; +#X connect 5 1 12 0; +#X connect 6 0 4 1; +#X connect 6 0 8 0; +#X connect 7 0 4 1; +#X connect 7 0 8 0; +#X connect 8 0 10 1; +#X connect 9 0 10 0; +#X connect 10 0 3 1; +#X connect 11 0 3 1; +#X connect 12 0 11 0; +#X connect 12 1 7 0; +#X connect 12 2 3 0; +#X connect 12 3 6 0; +#X restore 124 186 pd list-grow; +#X obj 124 162 t b; +#X msg 62 14 a b c d | e f g h i | j k | l m n o p q r s | t u v; +#X msg 246 86 |; +#X obj 295 178 \$2; +#X obj 329 178 \$2; +#X obj 124 318 list-slice; +#X obj 124 212 list prepend 0; +#X obj 329 205 + 1; +#X obj 125 419 list-slice; +#X obj 160 383 unpack f f; +#X obj 295 119 inlet; +#X obj 295 148 t a a; +#X msg 353 119 0; +#X obj 173 484 print; +#X msg 386 121 2; +#X obj 227 348 print; +#X obj 124 263 list append; +#X obj 123 47 t b a a a; +#X obj 157 235 list length; +#X connect 0 0 6 1; +#X connect 0 1 7 0; +#X connect 1 0 0 0; +#X connect 2 0 24 0; +#X connect 3 0 15 0; +#X connect 4 0 3 0; +#X connect 4 1 16 0; +#X connect 6 0 13 0; +#X connect 7 0 6 0; +#X connect 8 0 24 0; +#X connect 9 0 1 1; +#X connect 10 0 12 1; +#X connect 11 0 14 0; +#X connect 12 0 4 0; +#X connect 12 0 22 0; +#X connect 13 0 23 0; +#X connect 14 0 12 2; +#X connect 15 0 5 0; +#X connect 15 0 20 0; +#X connect 16 0 15 1; +#X connect 16 1 15 2; +#X connect 17 0 18 0; +#X connect 18 0 10 0; +#X connect 18 1 11 0; +#X connect 19 0 18 0; +#X connect 21 0 18 0; +#X connect 23 0 12 0; +#X connect 24 0 1 0; +#X connect 24 1 0 1; +#X connect 24 2 25 0; +#X connect 24 3 3 1; +#X connect 25 0 23 1; -- cgit v1.2.1