guile-user
[Top][All Lists]
Advanced

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

Re: Define in let


From: Thompson, David
Subject: Re: Define in let
Date: Tue, 20 Aug 2013 12:57:15 -0400

On Tue, Aug 20, 2013 at 12:39 PM, Dmitry Bogatov <address@hidden> wrote:

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?


The problem is that you have an invalid `let` form. You need an _expression_ besides `define`.

Something like this would be valid:

(let ((a 2))
  (define (foo x) (+ a x))
  (foo 4))
 

Please, keep in CC, I am not subscribed.

--
Best regards, Dmitry Bogatov <address@hidden>,
Free Software supporter and netiquette guardian.
        git clone git://kaction.name/rc-files.git --depth 1
        GPG: 54B7F00D
Html mail and proprietary format attachments are forwarded to /dev/null.

- Dave Thompson


reply via email to

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