From unknown Mon Jun 23 07:48:49 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13835: [PATCH] Let reverse! accept arbitrary types as second argument (new_tail) 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 To: 13835@debbugs.gnu.org Cc: David Kastrup X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136197967029750 (code B ref -1); Wed, 27 Feb 2013 15:42:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Feb 2013 15:41:10 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 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 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 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 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 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 Received: by lola (Postfix, from userid 1000) id 5E4B1200B5A; Wed, 27 Feb 2013 16:37:37 +0100 (CET) From: David Kastrup Date: Wed, 27 Feb 2013 16:37:21 +0100 Message-Id: <1361979441-5692-1-git-send-email-dak@gnu.org> 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-Received-From: 208.118.235.17 X-Spam-Score: -4.9 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.6 (-------) 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 From unknown Mon Jun 23 07:48:49 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: David Kastrup Subject: bug#13835: closed (Re: bug#13835: [PATCH] Let reverse! accept arbitrary types as second argument (new_tail)) Message-ID: References: <87fw0hxl3z.fsf@tines.lan> <1361979441-5692-1-git-send-email-dak@gnu.org> X-Gnu-PR-Message: they-closed 13835 X-Gnu-PR-Package: guile X-Gnu-PR-Keywords: patch Reply-To: 13835@debbugs.gnu.org Date: Thu, 28 Feb 2013 01:53:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1362016382-20737-1" This is a multi-part message in MIME format... ------------=_1362016382-20737-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13835: [PATCH] Let reverse! accept arbitrary types as second argument (new= _tail) which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 13835@debbugs.gnu.org. --=20 13835: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13835 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1362016382-20737-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13835-done) by debbugs.gnu.org; 28 Feb 2013 01:52:40 +0000 Received: from localhost ([127.0.0.1]:54555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAsfl-0005Nk-18 for submit@debbugs.gnu.org; Wed, 27 Feb 2013 20:52:40 -0500 Received: from world.peace.net ([96.39.62.75]:35473) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAsfe-0005NZ-Qp for 13835-done@debbugs.gnu.org; Wed, 27 Feb 2013 20:52:34 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UAsdj-0008GK-Ee; Wed, 27 Feb 2013 20:50:31 -0500 From: Mark H Weaver To: David Kastrup Subject: Re: bug#13835: [PATCH] Let reverse! accept arbitrary types as second argument (new_tail) References: <1361979441-5692-1-git-send-email-dak@gnu.org> Date: Wed, 27 Feb 2013 20:50:24 -0500 In-Reply-To: <1361979441-5692-1-git-send-email-dak@gnu.org> (David Kastrup's message of "Wed, 27 Feb 2013 16:37:21 +0100") Message-ID: <87fw0hxl3z.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13835-done Cc: 13835-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) David Kastrup writes: > 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 [...] Looks good to me. Applied, thanks! Mark ------------=_1362016382-20737-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Feb 2013 15:41:10 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 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 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 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 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 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 Received: by lola (Postfix, from userid 1000) id 5E4B1200B5A; Wed, 27 Feb 2013 16:37:37 +0100 (CET) From: David Kastrup To: bug-guile@gnu.org Subject: [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> 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-Received-From: 208.118.235.17 X-Spam-Score: -4.9 (----) X-Debbugs-Envelope-To: submit Cc: David Kastrup X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.6 (-------) 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 ------------=_1362016382-20737-1--