From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.bugs Subject: [bug #33854] tree-il->scheme does not translate to corrct case-lambda statement Date: Mon, 25 Jul 2011 10:58:11 +0000 Message-ID: <20110725-105810.sv78157.50872@savannah.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=UTF-8 X-Trace: dough.gmane.org 1311591482 29341 80.91.229.12 (25 Jul 2011 10:58:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 25 Jul 2011 10:58:02 +0000 (UTC) To: Stefan Israelsson Tampe , bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jul 25 12:57:58 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QlIrF-0006ws-Ta for guile-bugs@m.gmane.org; Mon, 25 Jul 2011 12:57:58 +0200 Original-Received: from localhost ([::1]:49940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlIrF-0000X6-Az for guile-bugs@m.gmane.org; Mon, 25 Jul 2011 06:57:57 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:57209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlIrC-0000VU-8z for bug-guile@gnu.org; Mon, 25 Jul 2011 06:57:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlIrB-0000dB-FU for bug-guile@gnu.org; Mon, 25 Jul 2011 06:57:54 -0400 Original-Received: from savannah.gnu.org ([140.186.70.70]:59611 helo=frontend.savannah.gnu.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlIrB-0000d7-CZ for bug-guile@gnu.org; Mon, 25 Jul 2011 06:57:53 -0400 Original-Received: from www-data by frontend.savannah.gnu.org with local (Exim 4.72) (envelope-from ) id 1QlIrT-0005dE-3s; Mon, 25 Jul 2011 10:58:11 +0000 X-PHP-Originating-Script: 0:sendmail.php X-Savane-Server: savannah.gnu.org:443 [140.186.70.70] X-Savane-Project: guile X-Savane-Tracker: bugs X-Savane-Item-ID: 33854 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101216 Linux Mint/1 (Debian) Firefox/3.6.13 X-Apparently-From: 82.182.254.46 (Savane authenticated user tampe) Original-References: In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.70 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list 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:5742 Archived-At: URL: Summary: tree-il->scheme does not translate to corrct case-lambda statement Project: Guile Submitted by: tampe Submitted on: Mon 25 Jul 2011 10:58:10 AM GMT Category: None Severity: 3 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any _______________________________________________________ Details: Problem scheme@(guile-user)> (tree-il->scheme (macroexpand '(define f (case-lambda ((a) a) ((a b) b))))) $1 = (define f (case-lambda ((#{a 1029}#) #{a 1029}#) (#{a 1031}# #{b 1032}#) #{b 1032}#)) The reason is that the last statement is translated to lambda e.g. (lambda (a b) b) but code assumes (case-lambda ((a b) b))) and then when splicing with (cdr tail-result) the wrong form will appear. The solution is to write a custom "cdr" function that check to see if the car is lambda lambda* case-lambda case-lambda* and depending on lambda or case-lambda forms issue different cdr versions so that the overall case-lambda will be well formed. _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/