Re: escaping from a recursive call

2022-11-10 Thread Olivier Dion via General Guile related discussions
On Thu, 10 Nov 2022, Damien Mattei wrote: > will it work well in // code with future or thread ,i'm having already > problem with // code that,compute well but show no speed up, is it because > of continuation? not being compatible with //,does macro generates > functions that causes unknown probl

Re: escaping from a recursive call

2022-11-10 Thread Damien Mattei
solutions have been posted, i'm using mine, which update my 'def macro: ;; (def (bar n);; (cond ((= n 0) 'end0);; ((= n 7) (return-rec 'end7));; (else (cons n (bar {n - 1}) ;; scheme@(guile-user)> (bar 5);; $4 = (5 4 3 2 1 . end0);; scheme@(guile-user)> (bar 10);; $5 = end7 (defi

Re: escaping from a recursive call

2022-11-10 Thread Chris Vine
On Wed, 09 Nov 2022 12:55:42 -0500 Olivier Dion via General Guile related discussions wrote: > On Wed, 09 Nov 2022, Damien Mattei wrote: > > but in the general case , i want a macro that can do it on any function > > (i'm not sure it can be done because the continuation have to be captured > > j

Re: escaping from a recursive call

2022-11-09 Thread Damien Mattei
oui bonne illustration du probléme... yes good explanation of problem... it's not simple, hope my macro is ok, for now all my code compile and run the same way ! :-) (but still no speed up :-( ) merçi Damien On Thu, Nov 10, 2022 at 5:57 AM wrote: > On Wed, Nov 09, 2022 at 08:20:31PM -0500, Olivi

Re: escaping from a recursive call

2022-11-09 Thread Damien Mattei
yes Olivier, i had found the Guile doc and i was asking myself, but the doc is quite "succint" without a lot of explanation and i'm asking if it exists more documentation and if it is or will be standardised in any R?RS... and i'm asking too how can it be integrated in my macro 'def to be used in

Re: escaping from a recursive call

2022-11-09 Thread tomas
On Wed, Nov 09, 2022 at 08:20:31PM -0500, Olivier Dion via General Guile related discussions wrote: > On Wed, 09 Nov 2022, Damien Mattei wrote: > > good... thank, it works, i do not know a lot about 'prompts , a good > > explanation is here: > > > > https://stackoverflow.com/questions/29838344/wh

Re: escaping from a recursive call

2022-11-09 Thread Olivier Dion via General Guile related discussions
On Wed, 09 Nov 2022, Damien Mattei wrote: > good... thank, it works, i do not know a lot about 'prompts , a good > explanation is here: > > https://stackoverflow.com/questions/29838344/what-exactly-is-a-continuation-prompt In the Guile manual: Top > API Reference > Control Mechanisms > Prompts

Re: escaping from a recursive call

2022-11-09 Thread Zelphir Kaltstahl
Hello Damien, On 11/9/22 18:18, Damien Mattei wrote: but in the general case , i want a macro that can do it on any function (i'm not sure it can be done because the continuation have to be captured just before the call to the function and be inlined at the good place) On Wed, Nov 9, 2022

Re: escaping from a recursive call

2022-11-09 Thread Damien Mattei
good... thank, it works, i do not know a lot about 'prompts , a good explanation is here: https://stackoverflow.com/questions/29838344/what-exactly-is-a-continuation-prompt i personally find a solution too: (define-syntax def (lambda (stx) (syntax-case stx () ;; multiple definitions w

Re: escaping from a recursive call

2022-11-09 Thread Olivier Dion via General Guile related discussions
On Wed, 09 Nov 2022, Damien Mattei wrote: > but in the general case , i want a macro that can do it on any function > (i'm not sure it can be done because the continuation have to be captured > just before the call to the function and be inlined at the good > place) I'm not aware of any cont

Re: escaping from a recursive call

2022-11-09 Thread Damien Mattei
but in the general case , i want a macro that can do it on any function (i'm not sure it can be done because the continuation have to be captured just before the call to the function and be inlined at the good place) On Wed, Nov 9, 2022 at 5:52 PM Olivier Dion wrote: > On Wed, 09 Nov 2022,

Re: escaping from a recursive call

2022-11-09 Thread Olivier Dion via General Guile related discussions
On Wed, 09 Nov 2022, Damien Mattei wrote: > i need a way to escape not only the current call of a recursive function > (it is already done) but alls: > > example: > > (def (foo n) > (cond ((= n 0) 'end0) > ((= n 7) (return 'end7)) > (else (cons n (foo {n - 1}) Is that what you want?