guile-user
[Top][All Lists]
Advanced

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

Re: Define in let


From: Ian Price
Subject: Re: Define in let
Date: Tue, 20 Aug 2013 18:19:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Dmitry Bogatov <address@hidden> writes:

> It seems following is invalid:
>
>    (let ((a 2))
>         (define (foo x) (+ a x)))
>
> I prefer to reduce scope of variable as much as possible, so
> I find this restriction unconvinent. Is is part of standard or technical
> limitation? Is it any workaround?

It's not a limitation, but a misunderstanding. Define creates a binding
in the _current_ scope, not the top level one.


-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"



reply via email to

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