From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Maciek Godek" Newsgroups: gmane.lisp.guile.user Subject: Me no understand scoping Date: Tue, 29 Jul 2008 23:18:05 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217366301 17477 80.91.229.12 (29 Jul 2008 21:18:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2008 21:18:21 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jul 29 23:19:11 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KNwb8-0004xC-40 for guile-user@m.gmane.org; Tue, 29 Jul 2008 23:19:10 +0200 Original-Received: from localhost ([127.0.0.1]:57358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNwaD-0000Ax-Q3 for guile-user@m.gmane.org; Tue, 29 Jul 2008 17:18:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KNwa9-00008S-8J for guile-user@gnu.org; Tue, 29 Jul 2008 17:18:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KNwa7-000062-L2 for guile-user@gnu.org; Tue, 29 Jul 2008 17:18:08 -0400 Original-Received: from [199.232.76.173] (port=53464 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNwa7-00005n-A8 for guile-user@gnu.org; Tue, 29 Jul 2008 17:18:07 -0400 Original-Received: from wf-out-1314.google.com ([209.85.200.175]:62674) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KNwa7-0002hL-1m for guile-user@gnu.org; Tue, 29 Jul 2008 17:18:07 -0400 Original-Received: by wf-out-1314.google.com with SMTP id 28so58054wfc.24 for ; Tue, 29 Jul 2008 14:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=JgZ0JRBA+jifjZQdq5z8RoehZvLBWsyW029VmlU2qgY=; b=rJprJls1ZPb+ZqHpX4s/pok3nFfUjiwbaecrXz/edtNZ0FHr8kGNHN30oLskygz3zk CR/EZ0hgVXGO/dxPssgRqRlrNtRtk323uyUJ2gTC970LE9QLx1Y3GyftJl7pT07e3efl Bwa+3KMyc+OhUvWgiQafxjldxHg1HwRFXcbq8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=aQgRB87M3meSBc5Oh7hbu0BL3mzHXzbouzSZZOJhsp/li39ITStrta9Q+X+4LG/z8c J2asiNr3DIzYKbqpvmbRq3GiK79FYRhGE7hzokV6CPMozw5b/fVKx9waVWmFZaCfzuQh SoJ6/E8iuhy1h3hQtwJtwl5VS4W/JGitNQrlA= Original-Received: by 10.142.231.7 with SMTP id d7mr1206242wfh.264.1217366285516; Tue, 29 Jul 2008 14:18:05 -0700 (PDT) Original-Received: by 10.142.141.17 with HTTP; Tue, 29 Jul 2008 14:18:05 -0700 (PDT) Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6699 Archived-At: 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.