Re: A proper tail version of with-fluids

2013-01-21 Thread Andy Wingo
On Fri 04 Jan 2013 00:36, l...@gnu.org (Ludovic Courtès) writes: Hmm, I can’t see how ‘with-fluids’ or ‘parameterize’ could be tail-recursive given that it uses ‘dynamic-wind’. Am I missing something? It doesn't use dynamic-wind. scheme@(guile-user) ,x (lambda () (with-fluids ((foo 1)) 2))

Re: A proper tail version of with-fluids

2013-01-04 Thread Stefan Israelsson Tampe
You are correct Noha, but please play down the impressed part, we have not reached the goal yet. 1. I did not implement the proper full scale one where we actually can (In case of knowing that no continuation have been stored, get proper tail calls) The reason is that 1. It contains a significant

Re: A proper tail version of with-fluids

2013-01-03 Thread Ludovic Courtès
Hi Stefan, Stefan Israelsson Tampe stefan.ita...@gmail.com skribis: (define f (lambda (n) (if (= n 0) (fluid-ref a) (with-fluids ((a n)) (f (- n 1)) with the modified VM: scheme@(guile-user) (f 1000) $2 = 1 with the old VM, it craches. It works! Hmm, I can’t see how

Re: A proper tail version of with-fluids

2013-01-03 Thread Noah Lavine
I think with-fluids could at least be semi-tail-recursive. If you imagine a normal non-tail-recursive implementation, you might get to a point where your continuation is going to set a fluid back to a value, and then the *next* continuation is going to set that fluid back to *another* value. Since