[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] continuation example: different behavior from other
From: |
Ricardo Gabriel Herdt |
Subject: |
Re: [Chicken-users] continuation example: different behavior from other Scheme implementations |
Date: |
Sat, 19 Oct 2019 18:35:49 +0200 |
User-agent: |
Posteo Webmail |
Am 19.10.2019 15:46 schrieb megane:
There's special compiler syntax for map; search for 'map-loop in the
sources. You can also see what your code expands to by giving -debug 2
flag to csc.
Thanks megane,
with -debug 2 I see that map uses some local variables that are changed
with set! in the loop, so it's quite more complex than I thought, and
this explains the behavior seen. Thanks for the hints.
;; generated code
(set! numbers
(let ((g2836 (scheme#cons (##core#undefined) '())))
(let ((g2737 g2836) (g2938 capture-from-map) (g3539 '(1 2 3 4 5 6)))
(let ((t46 (##sys#check-list g3539 'map)))
(##core#app
(let ((map-loop2340 (##core#undefined)))
(let ((t45 (set! map-loop2340
(##core#lambda
(g3541)
(if (scheme#pair? g3541)
(let ((g2442 (scheme#cons (g2938
(##sys#slot g3541 '0)) '())))
(let ((t43 (##sys#setslot g2836 '1
g2442)))
(let ((t44 (set! g2836 g2442)))
(##core#app map-loop2340 (##sys#slot
g3541 '1)))))
(##sys#slot g2737 '1))))))
(let () map-loop2340)))
g3539)))))
Regards,
Ricardo