Hi Will,

On Wed 09 May 2012 15:49, w...@ccs.neu.edu writes:

> (define (f m n)
>   (define (g i)
>     (define (h j)
>       (if (= j 0)
>           #t
>           (g (- j 1))))
>     (if (= i 0)
>       (if (= i m)
>             (list h)    ; closure must be allocated here
>             #f)
>       (h (- i 1))))
>   (g n))
>
> With the R6RS semantics, a compiler is allowed to rewrite the
> (list h) as (list (lambda (j) (h j))), which means the closure
> will be allocated only if i=m=0.  With that rewrite, f allocates
> no storage at all unless its first argument is zero.

Isn't it permitted this rewrite either way, given that the other one
will certainly be inlined, and thus there will only be one copy of the
procedure?

I'm with you but I'm having a hard time finding an example :)

Cheers,

Andy
-- 
http://wingolog.org/

_______________________________________________
r6rs-discuss mailing list
r6rs-discuss@lists.r6rs.org
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to