Re: Unyeilding a permutation generator

2008-11-04 Thread Jorgen Grahn
On 3 Nov 2008 22:13:42 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 03 Nov 2008 21:09:58 +, Jorgen Grahn wrote: > >> Why multi-threading? I see no concurrency in the original algorithm. >> There is, in my mind, nothing concurrent about 'yield'. > > No "real" concurrency b

Re: Unyeilding a permutation generator

2008-11-04 Thread Gerard Flanagan
On Nov 3, 11:45 pm, [EMAIL PROTECTED] wrote: > > Thats interesting code but seems to give a different output, > suggesting thet the underlying algorithm is different. > Ignoring linebreaks and case, the original code gives: > abcd bacd bcad bcda acbd cabd cbad cbda acdb cadb cdab cdba abdc badc > b

Re: Unyeilding a permutation generator

2008-11-04 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: [...] > Thats interesting code but seems to give a different output, > suggesting thet the underlying algorithm is different. Yes. Yours takes the first element out of the list and inserts it in every position of all the permutations of the list without the first element

Re: Unyeilding a permutation generator

2008-11-04 Thread sillyhat
On 2 Nov, 22:03, Carsten Haese <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Anyway what I want to do is experiment with code similar to this (i.e. > > same algorithm and keep the recursion) in other languages, > > particularly vbscript and wondered what it would look like if it was > >

Re: Unyeilding a permutation generator

2008-11-03 Thread sillyhat
On Nov 3, 4:24 pm, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Nov 2, 10:34 pm, [EMAIL PROTECTED] wrote: > > > Anyway what I want to do is experiment with code similar to this (i.e. > > same algorithm and keep the recursion) in other languages, > > particularly vbscript and wondered what it w

Re: Unyeilding a permutation generator

2008-11-03 Thread Aaron Brady
On Nov 3, 4:13 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 03 Nov 2008 21:09:58 +, Jorgen Grahn wrote: > > Why multi-threading?  I see no concurrency in the original algorithm. > > There is, in my mind, nothing concurrent about 'yield'. > > No "real" concurrency but a gene

Re: Unyeilding a permutation generator

2008-11-03 Thread Marc 'BlackJack' Rintsch
On Mon, 03 Nov 2008 21:09:58 +, Jorgen Grahn wrote: > Why multi-threading? I see no concurrency in the original algorithm. > There is, in my mind, nothing concurrent about 'yield'. No "real" concurrency but a generator can be seen as independent thread of code where the generator code is al

Re: Unyeilding a permutation generator

2008-11-03 Thread Jorgen Grahn
On Sun, 2 Nov 2008 14:09:01 -0800 (PST), Aaron Brady <[EMAIL PROTECTED]> wrote: > On Nov 2, 3:34 pm, [EMAIL PROTECTED] wrote: ... >> for x in  all_permx("ABCD"): >>   print x ... > I think multi-threading is the "truest" to the original. You might > develop a framework to set events when particula

Re: Unyeilding a permutation generator

2008-11-03 Thread Michele Simionato
On Nov 2, 10:34 pm, [EMAIL PROTECTED] wrote: > Anyway what I want to do is experiment with code similar to this (i.e. > same algorithm and keep the recursion) in other languages, > particularly vbscript and wondered what it would look like if it was > rewritten to NOT use the yield statement - or a

Re: Unyeilding a permutation generator

2008-11-03 Thread Terry Reedy
Steve Holden wrote: [EMAIL PROTECTED] wrote: Anyway what I want to do is experiment with code similar to this (i.e. same algorithm and keep the recursion) in other languages, particularly vbscript and wondered what it would look like if it was rewritten to NOT use the yield statement - or at l

Re: Unyeilding a permutation generator

2008-11-02 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hello, can someone please help. > > I found the following code at http://code.activestate.com/recipes/252178/ > > def all_perms(str): > if len(str) <=1: > yield str > else: > for perm in all_perms(str[1:]): > for i in range(len(perm)+

Re: Unyeilding a permutation generator

2008-11-02 Thread Aaron Brady
On Nov 2, 3:34 pm, [EMAIL PROTECTED] wrote: > Hello, can someone please help. > > I found the following code athttp://code.activestate.com/recipes/252178/ > > def all_perms(str): >     if len(str) <=1: >         yield str >     else: >         for perm in all_perms(str[1:]): >             for i in

Re: Unyeilding a permutation generator

2008-11-02 Thread Carsten Haese
[EMAIL PROTECTED] wrote: > Anyway what I want to do is experiment with code similar to this (i.e. > same algorithm and keep the recursion) in other languages, > particularly vbscript and wondered what it would look like if it was > rewritten to NOT use the yield statement An obvious (though memory

Re: Unyeilding a permutation generator

2008-11-02 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Anyway what I want to do is experiment with code similar to this (i.e. > same algorithm and keep the recursion) in other languages, > particularly vbscript and wondered what it would look like if it was > rewritten to NOT use the yield statement - Without the yield sta

Unyeilding a permutation generator

2008-11-02 Thread sillyhat
Hello, can someone please help. I found the following code at http://code.activestate.com/recipes/252178/ def all_perms(str): if len(str) <=1: yield str else: for perm in all_perms(str[1:]): for i in range(len(perm)+1): #nb str[0:1] works in bot