From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Josep Portella Florit Newsgroups: gmane.lisp.guile.bugs Subject: bug#14859: my-or macro in documentation Date: Sat, 13 Jul 2013 20:52:45 +0200 Message-ID: <51E1A1FD.8000104@primfilat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1373749170 9196 80.91.229.3 (13 Jul 2013 20:59:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Jul 2013 20:59:30 +0000 (UTC) To: 14859@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Jul 13 22:59:30 2013 Return-path: Envelope-to: guile-bugs@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 1Uy6uf-0008Go-G2 for guile-bugs@m.gmane.org; Sat, 13 Jul 2013 22:59:29 +0200 Original-Received: from localhost ([::1]:58384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy6uf-00073q-8D for guile-bugs@m.gmane.org; Sat, 13 Jul 2013 16:59:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy5Ei-0001hT-Qs for bug-guile@gnu.org; Sat, 13 Jul 2013 15:12:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy5Eg-0000YM-Kl for bug-guile@gnu.org; Sat, 13 Jul 2013 15:12:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy5Eg-0000YI-HR for bug-guile@gnu.org; Sat, 13 Jul 2013 15:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Uy5Eg-000063-32 for bug-guile@gnu.org; Sat, 13 Jul 2013 15:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Josep Portella Florit Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 13 Jul 2013 19:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14859 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1373742701330 (code B ref -1); Sat, 13 Jul 2013 19:12:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Jul 2013 19:11:41 +0000 Original-Received: from localhost ([127.0.0.1]:53150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uy5EK-00005E-Ao for submit@debbugs.gnu.org; Sat, 13 Jul 2013 15:11:40 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44347) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uy4wN-0007wW-FV for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:53:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy4wF-0003CE-TJ for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:53:02 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wF-0003C8-QL for submit@debbugs.gnu.org; Sat, 13 Jul 2013 14:52:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wC-0007pT-Sp for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uy4wA-0003BW-CV for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:56 -0400 Original-Received: from primfilat.com ([71.19.154.166]:45794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uy4wA-0003BG-6H for bug-guile@gnu.org; Sat, 13 Jul 2013 14:52:54 -0400 Original-Received: from [192.168.0.2] (unknown [46.18.41.120]) by primfilat.com (Postfix) with ESMTPSA id 006547B8F9 for ; Sat, 13 Jul 2013 20:58:52 +0200 (CEST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 X-Enigmail-Version: 1.5.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sat, 13 Jul 2013 15:11:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Sat, 13 Jul 2013 16:59:27 -0400 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7208 Archived-At: Hi! The my-or example macro in the documentation has a subtle bug. (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if exp exp (my-or rest ...))))))) (my-or #f "rockaway beach")) In the third rule t is bound to exp, presumably to use t instead of exp to prevent evaluating exp multiple times, but t is never used and exp is used again. This is the bug in action: scheme@(guile-user)> (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if exp exp (my-or rest ...))))))) (my-or (display "*") 1)) ***scheme@(guile-user)> I'm sure you already know how to fix it :-) (letrec-syntax ((my-or (syntax-rules () ((my-or) #t) ((my-or exp) exp) ((my-or exp rest ...) (let ((t exp)) (if t t (my-or rest ...))))))) (my-or #f "rockaway beach")) Josep