[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Re: Style Guide

From: Kon Lovett
Subject: Re: [Chicken-users] Re: Style Guide
Date: Tue, 6 Nov 2007 09:21:23 -0800

On Nov 6, 2007, at 6:30 AM, Sunnan wrote:

Jörg F. Wittenberger wrote:
For pure chicken code this maybe correct.

But some Scheme implementations happen to treat the former form as a
global variable, which can be set! later on, while the latter is beeing
compiled into a static binding and set! on it will raise an error.
Thanks for this clarification, I didn't know that.

However, since I only seldomly use set! on functions, I guess I'd prefer the latter form anyway.

One notable exception is this (disgusting?) idiom I invented for making generators without call/cc yield:

(define (fib)
 (let loop ((a 1) (b 1))
   (set! fib (lambda () (loop b (+ a b))))

;; maybe non-portable outside of current chicken semantics?

Except for the caveat about some compilers, no. However the above doesn't "make" a generator, in the sense that it can be reused. To restart the sequence 'fib' must be rebound. Certainly not "disgusting", just of limited use.

Chicken-users mailing list

Best Wishes,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]