[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Me no understand scoping
From: |
Maciek Godek |
Subject: |
Me no understand scoping |
Date: |
Tue, 29 Jul 2008 23:18:05 +0200 |
Hi,
consider the following code (simple iteration
construct invented mainly to cause naming
conflict, as the function 'times' is already
defined in guile)
(define-macro (times n f)
`(let ((env (the-environment)))
(let loop ((i 0))
(if (< i ,n)
(begin
(local-eval ,f env)
(loop (1+ i))
)
)
)
)
)
the whole thing with env was made as
a workaround disallowing f to see the
i variable defined in the macro (and to
perhaps see the value that otherwise
would be shadowed)
however,
(times 20 (display i))
yields
012345678910111213141516171819
Why?
--
Regards
M.
- Me no understand scoping,
Maciek Godek <=
- Re: Me no understand scoping, Clinton Ebadi, 2008/07/29
- Re: Me no understand scoping, Maciek Godek, 2008/07/30
- Re: Me no understand scoping, Jon Wilson, 2008/07/30
- Re: Me no understand scoping, Klaus Schilling, 2008/07/30
- Re: Me no understand scoping, Maciek Godek, 2008/07/30
- Re: Me no understand scoping, Neil Jerram, 2008/07/31
- Re: Me no understand scoping, Maciek Godek, 2008/07/31
- Re: Me no understand scoping, Neil Jerram, 2008/07/31
- Re: Me no understand scoping, Maciek Godek, 2008/07/31
- Re: Me no understand scoping, Clinton Ebadi, 2008/07/31