From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Re: Expanding macros Date: Fri, 28 Sep 2012 17:52:19 +0200 Message-ID: References: <873924phzt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1348847556 29267 80.91.229.3 (28 Sep 2012 15:52:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Sep 2012 15:52:36 +0000 (UTC) Cc: guile-user@gnu.org To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Sep 28 17:52:41 2012 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 1THcrk-0003QQ-4C for guile-user@m.gmane.org; Fri, 28 Sep 2012 17:52:36 +0200 Original-Received: from localhost ([::1]:56577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcre-0007fl-Vo for guile-user@m.gmane.org; Fri, 28 Sep 2012 11:52:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcrX-0007eg-Au for guile-user@gnu.org; Fri, 28 Sep 2012 11:52:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THcrW-00049O-4F for guile-user@gnu.org; Fri, 28 Sep 2012 11:52:23 -0400 Original-Received: from mail-bk0-f41.google.com ([209.85.214.41]:40548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcrV-00045y-UI; Fri, 28 Sep 2012 11:52:22 -0400 Original-Received: by bkcjm1 with SMTP id jm1so3541848bkc.0 for ; Fri, 28 Sep 2012 08:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=82oszbwUI9o1uVemMZpGpKnxeGCByORAIvS47Pxx6iA=; b=y0Xh5zQCBwHbDPuCfZkPB71PODLZIif2xXtov+GJzf6iM+J5xdKUZWDgM5Sx6MLfBY o9A0cEBggEgfiSM/RSh0t1dPPBw5ynAnpJumfBdB5jATqPQtHZ4oraRFRnHTMyQXNuO3 pNO2Ct+aKly8A7FgqOA30MRI82rUhmeaPEua2tcbfvkwiZLwwtOvhhCWXHbpJfCZx2dQ 56d3Ym14mUcE6SHWxzCYwGr7pNpIvmyhirCrFeIB2ohhxWzdvuHwSpdAagB14HZHg0fh /VGcgxbfNR7mf/nqaoB03T85ZwZqvPbq1GI8/WZENC0JINAbr3FdepzPTU7+Gk2jQx2O 8CzQ== Original-Received: by 10.112.47.100 with SMTP id c4mr2897827lbn.49.1348847539919; Fri, 28 Sep 2012 08:52:19 -0700 (PDT) Original-Received: by 10.152.20.3 with HTTP; Fri, 28 Sep 2012 08:52:19 -0700 (PDT) In-Reply-To: <873924phzt.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.41 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:9596 Archived-At: Bonjour, > There=92s the ,expand command at the REPL. > > It=92s implemented like this: > > (define (repl-expand repl form) > (let ((from (repl-language repl)) > (opts (repl-compile-options repl))) > (decompile (compile form #:from from #:to 'tree-il #:opts opts > #:env (current-module)) > #:from 'tree-il #:to from))) > > Psyntax, the macro expander, returns tree-il, hence the need to go > through =91decompile=92. Thanks a lot. By the way, the (undocumented, as of 2.0.5) decompile function returns two values -- the first being the expanded expression and the second -- #f. As I've figured out from system/base/compile, the second return value is the environment, but I've been wondering under what circumstances would that value be different from #f. Best regards MG