I think maybe problems of this form need at most three objects, and
two if you could do
[t 200 300 400 ...].
-------------------------------------------------
[inlet]
| ________________
| | |
| [200 300 400{ |
| | |
| [unpack 0 0 0] |
| | | | |
[pack 0 200 300 400] |
| \_________________|
|
[outlet]
----------------------------------------------------
the outlet of the [pack] is connected to [200 300 400{ message as
well as the [outlet], in case the ascii didn't turn out well or was
ambiguous.
No trigger is necessary in this scenario since the order of operations
does not matter in this instance (though it might be better form/style
to reset the [pack] in the subpatch before sending the output, and
might be necessary if this were meant as an abstraction, where it
could be used in recursive loops).
However, I think Michal Seta's solution is a lot more scalable --
attached is a patch that shows what I mean.
Matt
> Date: Wed, 26 Nov 2008 10:52:09 +0100
> From: Frank Barknecht <[EMAIL PROTECTED]>
> Subject: Re: [PD] Pd exam 02: complete a longer list [was: Pd exam 01]
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
>
> Hallo,
> Michal Seta hat gesagt: // Michal Seta wrote:
>
>> Sorry, missed all the points on the first assignment.
>> Here's my contribution.
>
> I think, yours is a pretty cool, original and elegant solution!
>
> Ciao
> --
> Frank Barknecht Do You RjDj.me? _ ______footils.org__
>
>
#N canvas 45 66 651 865 10;
#X floatatom 105 751 5 0 0 0 - - -;
#X floatatom 74 776 5 0 0 0 - - -;
#N canvas 111 463 637 337 ???????? 0;
#X obj 86 16 inlet;
#X obj 86 232 outlet;
#X obj 194 127 list length;
#X obj 127 155 list split;
#X obj 86 192 list append;
#X msg 127 95 100;
#X obj 86 45 t a b a;
#X obj 262 16 inlet;
#N canvas 209 501 315 330 set_list 0;
#X obj 125 19 inlet;
#X obj 144 114 f;
#X obj 144 81 until;
#X msg 199 81 100;
#X obj 173 115 + 100;
#X obj 144 146 list prepend;
#X obj 144 168 t a;
#X obj 125 41 t b f b;
#X obj 81 193 list append;
#X obj 81 217 list prepend set;
#X obj 81 239 list trim;
#X obj 81 260 outlet;
#X connect 0 0 7 0;
#X connect 1 0 4 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
#X connect 3 0 1 1;
#X connect 4 0 1 1;
#X connect 5 0 6 0;
#X connect 6 0 8 1;
#X connect 6 0 5 1;
#X connect 7 0 8 0;
#X connect 7 1 2 0;
#X connect 7 2 3 0;
#X connect 7 2 5 1;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X restore 263 67 pd set_list;
#X connect 0 0 6 0;
#X connect 2 0 3 1;
#X connect 3 1 4 1;
#X connect 4 0 1 0;
#X connect 5 0 3 0;
#X connect 6 0 4 0;
#X connect 6 1 5 0;
#X connect 6 2 2 0;
#X connect 7 0 8 0;
#X connect 8 0 5 0;
#X restore 75 419 pd ????????;
#X text 176 419 <== fill in this part.;
#X text 42 29 Assignment 2:;
#X text 69 153 If there is no 2nd element in the list because the list
is too short \, send 200 instead.;
#X text 69 116 If there is no 3rd element in the list because the list
is too short \, send 300 instead.;
#X text 71 81 If there is no 4th element in the list because the list
is too short \, send 400 instead.;
#X msg 75 202 1 2 3 4;
#X text 164 199 this should set the number boxes to 1 \, 2 \, 3 \,
4;
#X msg 116 231 1 2 3;
#X text 185 232 this should set the number boxes to 1 \, 2 \, 3 \,
400;
#X msg 131 265 1 2;
#X text 186 268 this should set the number boxes to 1 \, 2 \, 300 \,
400;
#X msg 140 296 1;
#X text 194 298 this should set the number boxes to 1 \, 200 \, 300
\, 400;
#X text 42 50 Complete a longer list with default values.;
#X floatatom 169 699 5 0 0 0 - - -;
#X floatatom 137 724 5 0 0 0 - - -;
#X text 378 503 - Discuss the results with your classmates.;
#X text 378 477 - Go for a Pd-vanilla solution.;
#X text 232 449 reset;
#X floatatom 189 666 5 0 0 0 - - -;
#X floatatom 205 637 5 0 0 0 - - -;
#X floatatom 221 611 5 0 0 0 - - -;
#X floatatom 242 584 5 0 0 0 - - -;
#X floatatom 257 559 5 0 0 0 - - -;
#X floatatom 273 533 5 0 0 0 - - -;
#X obj 75 481 unpack 0 0 0 0 0 0 0 0 0 0 0;
#X floatatom 204 375 5 1 10 0 - - -;
#X msg 90 449 0 0 0 0 0 0 0 0 0 0;
#X obj 325 338 loadbang;
#X msg 325 358 4;
#X text 244 376 <== list length to supply defaults for;
#X connect 2 0 28 0;
#X connect 8 0 2 0;
#X connect 10 0 2 0;
#X connect 12 0 2 0;
#X connect 14 0 2 0;
#X connect 28 0 1 0;
#X connect 28 1 0 0;
#X connect 28 2 18 0;
#X connect 28 3 17 0;
#X connect 28 4 22 0;
#X connect 28 5 23 0;
#X connect 28 6 24 0;
#X connect 28 7 25 0;
#X connect 28 8 26 0;
#X connect 28 9 27 0;
#X connect 29 0 2 1;
#X connect 29 0 30 0;
#X connect 30 0 28 0;
#X connect 31 0 32 0;
#X connect 32 0 29 0;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list