From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ralf Mattes Newsgroups: gmane.lisp.guile.user Subject: Re: Define in let Date: Wed, 21 Aug 2013 11:28:51 +0200 Message-ID: <20130821092851.GA16017@seid-online.de> References: <87k3jgb9kr.fsf@gnu.org> <20130820180137.301ace7e@capac> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1377077848 6594 80.91.229.3 (21 Aug 2013 09:37:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Aug 2013 09:37:28 +0000 (UTC) Cc: "guile-user@gnu.org" , Dmitry Bogatov , David Pirotte To: Panicz Maciej Godek Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Aug 21 11:37:30 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VC4r3-0006ke-VE for guile-user@m.gmane.org; Wed, 21 Aug 2013 11:37:30 +0200 Original-Received: from localhost ([::1]:52436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC4r3-0001hA-KX for guile-user@m.gmane.org; Wed, 21 Aug 2013 05:37:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC4qr-0001g5-DL for guile-user@gnu.org; Wed, 21 Aug 2013 05:37:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VC4ql-0003Za-Qn for guile-user@gnu.org; Wed, 21 Aug 2013 05:37:17 -0400 Original-Received: from mail.seid-online.de ([5.199.139.24]:59732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC4ql-0003WT-JR; Wed, 21 Aug 2013 05:37:11 -0400 Original-Received: from ralf by mail.seid-online.de with local (Exim 4.80) (envelope-from ) id 1VC4ih-0004Aa-5m; Wed, 21 Aug 2013 11:28:51 +0200 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.199.139.24 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10659 Archived-At: On Wed, Aug 21, 2013 at 08:52:02AM +0200, Panicz Maciej Godek wrote: > 2013/8/20 David Pirotte > > > Hello, > > > > > 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 Scheme's idiomatic way to achieve the effect that you > probably want would be > (define foo #f) > (let ((a 2)) > (set! foo (lambda (x) (+ a x)))) I'd say this is extremly contorted and non-schemish. What's wrong with: (define foo (let ((a 2)) (lambda (arg) (+ a arg)))) This is the basic let-over-lambda closure .... Cheers, Ralf Mattes