From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.bugs Subject: bug#13835: [PATCH] Let reverse! accept arbitrary types as second argument (new_tail) Date: Wed, 27 Feb 2013 16:37:21 +0100 Message-ID: <1361979441-5692-1-git-send-email-dak@gnu.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1361979617 27207 80.91.229.3 (27 Feb 2013 15:40:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Feb 2013 15:40:17 +0000 (UTC) Cc: David Kastrup To: 13835@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed Feb 27 16:40:40 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 1UAj7X-0007Yr-Qm for guile-bugs@m.gmane.org; Wed, 27 Feb 2013 16:40:40 +0100 Original-Received: from localhost ([::1]:53265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAj7C-0001K2-Sc for guile-bugs@m.gmane.org; Wed, 27 Feb 2013 10:40:18 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAj78-0001Jk-K4 for bug-guile@gnu.org; Wed, 27 Feb 2013 10:40:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAj76-0005gV-65 for bug-guile@gnu.org; Wed, 27 Feb 2013 10:40:14 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAj76-0005g7-3K for bug-guile@gnu.org; Wed, 27 Feb 2013 10:40:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UAj8s-0007kx-NG for bug-guile@gnu.org; Wed, 27 Feb 2013 10:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: David Kastrup Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 27 Feb 2013 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13835 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.136197967029750 (code B ref -1); Wed, 27 Feb 2013 15:42:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Feb 2013 15:41:10 +0000 Original-Received: from localhost ([127.0.0.1]:53688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAj80-0007jl-59 for submit@debbugs.gnu.org; Wed, 27 Feb 2013 10:41:09 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57311) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAj7k-0007ik-HJ for submit@debbugs.gnu.org; Wed, 27 Feb 2013 10:41:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAj5w-000545-57 for submit@debbugs.gnu.org; Wed, 27 Feb 2013 10:39:01 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:60879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAj5w-000540-2Q for submit@debbugs.gnu.org; Wed, 27 Feb 2013 10:39:00 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAj5q-0008VH-Nx for bug-guile@gnu.org; Wed, 27 Feb 2013 10:39:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAj5l-00051R-PC for bug-guile@gnu.org; Wed, 27 Feb 2013 10:38:54 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAj5l-00051N-Mf for bug-guile@gnu.org; Wed, 27 Feb 2013 10:38:49 -0500 Original-Received: from localhost ([127.0.0.1]:59105 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAj5k-0006Lm-C8; Wed, 27 Feb 2013 10:38:48 -0500 Original-Received: by lola (Postfix, from userid 1000) id 5E4B1200B5A; Wed, 27 Feb 2013 16:37:37 +0100 (CET) X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 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:6800 Archived-At: There is no reason to restrict the type of the second argument to proper lists as it is added as last CDR to the list without interpretation. This allows for stack-depth friendly usage (simplified from an actual use case that blew up around my ears) like SCM my_tree_copy (SCM src) { if (scm_is_pair (src)) { SCM res = SCM_EOL; do { res = scm_cons (my_tree_copy (scm_car (src)), res); src = scm_cdr (src); } while (scm_is_pair (src)); return scm_reverse_x (res, my_tree_copy (src)); } return src; } * libguile/list.c (scm_reverse_x): remove typecheck for 2nd arg --- libguile/list.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libguile/list.c b/libguile/list.c index 6c8f8be..d30f9e8 100644 --- a/libguile/list.c +++ b/libguile/list.c @@ -377,8 +377,6 @@ SCM_DEFINE (scm_reverse_x, "reverse!", 1, 1, 0, SCM_VALIDATE_LIST (1, lst); if (SCM_UNBNDP (new_tail)) new_tail = SCM_EOL; - else - SCM_VALIDATE_LIST (2, new_tail); while (!SCM_NULL_OR_NIL_P (lst)) { -- 1.7.10.4