Re: [PD] [PD-dev] recursion in Gem - a tutorial

2007-07-23 Thread Mathieu Bouchard

On Thu, 19 Jul 2007, Claude Heiland-Allen wrote:

Again, I tried to create something similar in Pd, but ran into 
re-entrancy bugs whenever I tried to use recursion.  I do not write 
externals lightly, but in this case I think it was necessary.  If 
someone knows how to solve this in pure Pd, I'd be delighted.


To follow up on our discussion on the FreeNode #dataflow channel... think 
about what it takes for any object to figure out hey, I'm being used 
recursively!. Basically, if I use [+] recursively, there's no way that 
just by the order of use of the inlets it can figure out whether anything 
is recursive or not. What it can use is the outlets, but it can only 
figure out recursion when the left inlet gets stuffed, so if that is 
preceded immediately by a right inlet message, there's no way for that 
object to know whether the right inlet message is intended to accompany 
the recursive call or just configure the object for the benefit of the 
next non-recursive call. Both possibilities are legitimate uses that have 
to be supported.


Your only possibility, then, is to make something explicit, with methods 
push and pop that can handle backups of states of enough subobjects, 
or else do something really heavy for creating instances recursively by 
dynamic patching. (we're at the edge of what makes sense in a 
pd-style of dataflow... I suppose any solution will look weird)


(In DesireData it could look at pd_stack, but that wouldn't be fast and 
it's not enough because it still needs a state-preserving system)


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] [PD-dev] recursion in Gem - a tutorial

2007-07-19 Thread Patrice Colet



IOhannes m zmoelnig a écrit :

 (i haen't seen [nnrepeat] on the website, so i

don't know what it does) with [repeat] or with the [s]/[r] idiom claude
has proposed.


Apparently it does something like the attached patch, and the 
functionning is explained into the tutorial patch 06_break_symmetry.pd,
I just need now to go on linux and compile to see how significantly 
faster is the external compared with the patch.




nnrepeat.pd
Description: application/puredata


06_breaking_symmetry.pd
Description: application/puredata
begin:vcard
fn:Patrice Colet
n:Colet;Patrice
adr;dom:;;;Nice;;06100
email;internet:[EMAIL PROTECTED]
tel;cell:06 32 66 03 57
x-mozilla-html:FALSE
version:2.1
end:vcard

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] [PD-dev] recursion in Gem - a tutorial

2007-07-19 Thread Claude Heiland-Allen

Patrice Colet wrote:



IOhannes m zmoelnig a écrit :

 (i haen't seen [nnrepeat] on the website, so i

don't know what it does) with [repeat] or with the [s]/[r] idiom claude
has proposed.


Apparently it does something like the attached patch, and the 
functionning is explained into the tutorial patch 06_break_symmetry.pd,
I just need now to go on linux and compile to see how significantly 
faster is the external compared with the patch.


Again, I tried to create something similar in Pd, but ran into 
re-entrancy bugs whenever I tried to use recursion.  I do not write 
externals lightly, but in this case I think it was necessary.  If 
someone knows how to solve this in pure Pd, I'd be delighted.


Your abstraction doesn't do what you think it does in the presence of 
re-entrancy.  See attached test patch.



With max-depth = 2 and repetitions = 2.

My [nnrepeat] external:
-: 2 0
-: 1 0
-: 1 0
-: 1 1
-: 1 1
-: 2 0
-: 2 1
-: 1 0
-: 1 0
-: 1 1
-: 1 1
-: 2 1


Your [nnrepeat] abstraction:
-: 2 0
-: 1 1
-: 1 1
-: 1 2
-: 1 2
-: 2 2
-: 2 0
-: 1 1
-: 1 1
-: 1 2
-: 1 2
-: 2 2


#N canvas 0 0 481 517 10;
#X obj 71 95 r \$0-recurse;
#X obj 71 380 s \$0-recurse;
#X obj 140 270 t b a b;
#X obj 224 290 v \$0-depth;
#X obj 224 310 - 1;
#X obj 224 330 max 0;
#X obj 162 350 spigot;
#X obj 224 350 v \$0-depth;
#X obj 185 160 t b f;
#X obj 185 183 v \$0-depth;
#X obj 185 208 pack f f;
#X obj 140 290 v \$0-depth;
#X obj 140 330 v \$0-depth;
#X obj 140 310 + 1;
#X obj 108 50 t a b;
#X msg 108 21 nrepeat test;
#X obj 285 108 v \$0-depth;
#X floatatom 262 77 5 0 0 2 max-depth - -;
#X floatatom 261 38 5 0 0 2 repetitions - -;
#X obj 246 108 f 3;
#X obj 185 235 print -;
#X obj 98 160 t b f;
#X obj 98 183 v \$0-depth;
#X obj 98 208 pack f f;
#X obj 98 235 print -;
#X obj 108 135 nnrepeat 2;
#X connect 0 0 25 0;
#X connect 2 0 11 0;
#X connect 2 1 6 0;
#X connect 2 2 3 0;
#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 0;
#X connect 6 0 1 0;
#X connect 8 0 9 0;
#X connect 8 1 10 1;
#X connect 9 0 10 0;
#X connect 10 0 20 0;
#X connect 11 0 13 0;
#X connect 13 0 12 0;
#X connect 14 0 25 0;
#X connect 14 1 19 0;
#X connect 15 0 14 0;
#X connect 17 0 19 1;
#X connect 18 0 25 1;
#X connect 19 0 16 0;
#X connect 21 0 22 0;
#X connect 21 1 23 1;
#X connect 22 0 23 0;
#X connect 23 0 24 0;
#X connect 25 0 21 0;
#X connect 25 1 2 0;
#X connect 25 2 8 0;
___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] [PD-dev] recursion in Gem - a tutorial

2007-07-19 Thread Patrice Colet

Forget last mail, your patch is perfect, Claudius, very good.

patrice colet a écrit :

Yes, I've allready figured it out with testing your external on linux,
the dll is merely impossible to make with win32-mingw (so if someone has
succesfully made the dll, please share!) and with reading your last mail
to IOannes.


Le jeudi 19 juillet 2007 à 08:12 +, Claude Heiland-Allen a écrit :

Patrice Colet wrote:

IOhannes m zmoelnig a écrit :

 (i haen't seen [nnrepeat] on the website, so i

don't know what it does) with [repeat] or with the [s]/[r] idiom claude
has proposed.
Apparently it does something like the attached patch, and the 
functionning is explained into the tutorial patch 06_break_symmetry.pd,
I just need now to go on linux and compile to see how significantly 
faster is the external compared with the patch.
Again, I tried to create something similar in Pd, but ran into 
re-entrancy bugs whenever I tried to use recursion.  I do not write 
externals lightly, but in this case I think it was necessary.  If 
someone knows how to solve this in pure Pd, I'd be delighted.


Your abstraction doesn't do what you think it does in the presence of 
re-entrancy.  See attached test patch.



With max-depth = 2 and repetitions = 2.

My [nnrepeat] external:
-: 2 0
-: 1 0
-: 1 0
-: 1 1
-: 1 1
-: 2 0
-: 2 1
-: 1 0
-: 1 0
-: 1 1
-: 1 1
-: 2 1


Your [nnrepeat] abstraction:
-: 2 0
-: 1 1
-: 1 1
-: 1 2
-: 1 2
-: 2 2
-: 2 0
-: 1 1
-: 1 1
-: 1 2
-: 1 2
-: 2 2


pièce jointe document plein texte (nnrepeat-test.pd)
#N canvas 0 0 481 517 10;
#X obj 71 95 r \$0-recurse;
#X obj 71 380 s \$0-recurse;
#X obj 140 270 t b a b;
#X obj 224 290 v \$0-depth;
#X obj 224 310 - 1;
#X obj 224 330 max 0;
#X obj 162 350 spigot;
#X obj 224 350 v \$0-depth;
#X obj 185 160 t b f;
#X obj 185 183 v \$0-depth;
#X obj 185 208 pack f f;
#X obj 140 290 v \$0-depth;
#X obj 140 330 v \$0-depth;
#X obj 140 310 + 1;
#X obj 108 50 t a b;
#X msg 108 21 nrepeat test;
#X obj 285 108 v \$0-depth;
#X floatatom 262 77 5 0 0 2 max-depth - -;
#X floatatom 261 38 5 0 0 2 repetitions - -;
#X obj 246 108 f 3;
#X obj 185 235 print -;
#X obj 98 160 t b f;
#X obj 98 183 v \$0-depth;
#X obj 98 208 pack f f;
#X obj 98 235 print -;
#X obj 108 135 nnrepeat 2;
#X connect 0 0 25 0;
#X connect 2 0 11 0;
#X connect 2 1 6 0;
#X connect 2 2 3 0;
#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 0;
#X connect 6 0 1 0;
#X connect 8 0 9 0;
#X connect 8 1 10 1;
#X connect 9 0 10 0;
#X connect 10 0 20 0;
#X connect 11 0 13 0;
#X connect 13 0 12 0;
#X connect 14 0 25 0;
#X connect 14 1 19 0;
#X connect 15 0 14 0;
#X connect 17 0 19 1;
#X connect 18 0 25 1;
#X connect 19 0 16 0;
#X connect 21 0 22 0;
#X connect 21 1 23 1;
#X connect 22 0 23 0;
#X connect 23 0 24 0;
#X connect 25 0 21 0;
#X connect 25 1 2 0;
#X connect 25 2 8 0;



___
PD-dev mailing list
[EMAIL PROTECTED]
http://lists.puredata.info/listinfo/pd-dev


begin:vcard
fn:Patrice Colet
n:Colet;Patrice
adr;dom:;;;Nice;;06100
email;internet:[EMAIL PROTECTED]
tel;cell:06 32 66 03 57
x-mozilla-html:FALSE
version:2.1
end:vcard

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list