Re: [Chicken-users] possible lazy-let macro?

2005-11-17 Thread Daishi Kato
Hi! Nice to know of identifier-syntax. It looks useful once you understand how it works. I also found it is faster than delay/force, the functions are different though. Well, nonetheless, there still are some overheads, assigning variables, and cheking them if they are new. What I want is no

Re: [Chicken-users] possible lazy-let macro?

2005-11-17 Thread Daishi Kato
Hi, Thanks for many examples! At Thu, 17 Nov 2005 17:31:06 -, Thomas Chust wrote: For example (lazy-let ((a (get-a))) (let ((a (get-something-else))) (if (condition) a #f))) always evaluates (get-a) even though it is never needed, because it macroexpands into (begin

Re: [Chicken-users] possible lazy-let macro?

2005-11-17 Thread Alex Shinn
At Fri, 18 Nov 2005 08:18:11 +0900, Daishi Kato wrote: Would it be worth improving the lazy-let macro so that it understands at least let and quote forms? Not let forms. Analyzing subforms of a macro is called code-walking, and the first thing you then need to do is sc-expand the body or

Re: [Chicken-users] possible lazy-let macro?

2005-11-17 Thread Daishi Kato
Thanks, Tohmas and Alex! I think I understand that simple code-walking does not help, in many cases, for example, a loop. (lazy-let ((a (get-a))) (letrec ([b (lambda () (when (condition) (print a) (b)))]) (b))) OK, I would not need a general solution, let me think about it for a

Re: [Chicken-users] possible lazy-let macro?

2005-11-16 Thread Thomas Chust
Am 16.11.2005, 09:18 Uhr, schrieb Daishi Kato [EMAIL PROTECTED]: [...] Does anyone know of any existence of a lazy-let macro, which does the following? convert from (lazy-let ([a (get-a)][b (get-b)]) (if (condition) a b)) into (if (condition) (get-a) (get-b)) [...] Hello, I haven't

Re: [Chicken-users] possible lazy-let macro?

2005-11-16 Thread Daishi Kato
Hi, I have first considered the use of delay/force, but it turns out that it is a little bit costly. So, I want it to be done at the complie time. This should probablly be called let-ahead instead of lazy-let. Anyway, your macro example is helpful to me. Let me think again. Thanks, Daishi At

Re: [Chicken-users] possible lazy-let macro?

2005-11-16 Thread Alex Shinn
At Wed, 16 Nov 2005 18:18:00 +0900, Daishi Kato wrote: Does anyone know of any existence of a lazy-let macro, which does the following? convert from [...] (lazy-let ([a (get-a)][b (get-b)]) (if (condition) (begin (display a) a) (begin (display b) b))) into (if