emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#13835: closed ([PATCH] Let reverse! accept arbitra


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#13835: closed ([PATCH] Let reverse! accept arbitrary types as second argument (new_tail))
Date: Thu, 28 Feb 2013 01:53:01 +0000

Your message dated Wed, 27 Feb 2013 20:50:24 -0500
with message-id <address@hidden>
and subject line Re: bug#13835: [PATCH] Let reverse! accept arbitrary types as 
second argument (new_tail)
has caused the debbugs.gnu.org bug report #13835,
regarding [PATCH] Let reverse! accept arbitrary types as second argument 
(new_tail)
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
13835: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13835
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] Let reverse! accept arbitrary types as second argument (new_tail) Date: Wed, 27 Feb 2013 16:37:21 +0100
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




--- End Message ---
--- Begin Message --- Subject: Re: bug#13835: [PATCH] Let reverse! accept arbitrary types as second argument (new_tail) Date: Wed, 27 Feb 2013 20:50:24 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)
David Kastrup <address@hidden> 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


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]