From: Eric Jiang <erji...@indiana.edu> Subject: [Chicken-users] Internal defines broken when compiled? Date: Fri, 4 Feb 2011 11:47:18 -0500
> Hi all, > I wrote a procedure with several internal defines, and am running into > problems with the compiled program. Running the compiled program > gives an "unbound variable" error for a Chicken-generated variable. > > The following snippet reproduces the error: > > (define (x) > (define (foo) (length bar)) > (define bar `(1 2 3 ,foo)) > (foo)) > > (x) ;; should give 4 > > However, this example works when interpreted in csi and petite. I > searched the manual for some indication of whether this behavior in > csc is documented, but did not turn up anything. > This is invalid Scheme code: the internal defines are converted into a `letrec' form and in a `letrec', the right-hand-side expressions may not refer directly to the bound variables: (letrec ((foo ...) (bar foo)) ; illegal ...) (letrec ((foo ...) (bar (lambda ... foo ...))) ; ok ...) cheers, felix _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users