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

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

[debbugs-tracker] bug#24080: closed (fold-left description in (rnrs list


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#24080: closed (fold-left description in (rnrs lists) section of guile manual incorrect)
Date: Thu, 04 Aug 2016 20:41:01 +0000

Your message dated Thu, 04 Aug 2016 22:40:25 +0200
with message-id <address@hidden>
and subject line Re: bug#24080: fold-left description in (rnrs lists) section 
of guile manual incorrect
has caused the debbugs.gnu.org bug report #24080,
regarding fold-left description in (rnrs lists) section of guile manual 
incorrect
to be marked as done.

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


-- 
24080: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24080
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: fold-left description in (rnrs lists) section of guile manual incorrect Date: Tue, 26 Jul 2016 16:15:06 -0400
The section on the (rnrs lists) library in the guile manual contains the 
following:

Scheme Procedure: fold-left combine nil list1 list2 …
Scheme Procedure: fold-right combine nil list1 list2 …

    These procedures are identical to the fold and fold-right procedures 
provided by SRFI-1.

In the case of fold-left and SRFI-1 fold, this is not correct; the order in 
which the arguments are passed to the combine procedure is different. Compare:

(let ((f (lambda (a b) (format #f "(f ~a ~a)" a b))))
  (for-each
   (lambda (fold)
     (display (fold f "0" '(a b c d e)))
     (format #t " ; ~s\n" (procedure-name fold)) )
   (list (@ (rnrs lists) fold-left)
         (@ (rnrs lists) fold-right)    ;same as srfi-1 fold-right
         (@ (srfi srfi-1) fold)
         (@ (srfi srfi-1) fold-right))))

Output:

(f (f (f (f (f 0 a) b) c) d) e) ; fold-left
(f a (f b (f c (f d (f e 0))))) ; fold-right
(f e (f d (f c (f b (f a 0))))) ; fold
(f a (f b (f c (f d (f e 0))))) ; fold-right

In the single-list case, fold-left can be thought of as applying f 
left-associatively to the elements of the list.
Moreover, in this case (fold f nil l) == (fold-left (lambda (x y) (f y x)) nil 
l).

(In the case of fold-right, both versions are identical).



--- End Message ---
--- Begin Message --- Subject: Re: bug#24080: fold-left description in (rnrs lists) section of guile manual incorrect Date: Thu, 04 Aug 2016 22:40:25 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
On Tue 26 Jul 2016 22:15, "Glenn Michaels" <address@hidden> writes:

> The section on the (rnrs lists) library in the guile manual contains the 
> following:
>
> Scheme Procedure: fold-left combine nil list1 list2 …
> Scheme Procedure: fold-right combine nil list1 list2 …
>
>     These procedures are identical to the fold and fold-right procedures 
> provided by SRFI-1.

I believe this was fixed by

  commit 498cd58cb43e0dde024ad3c62983def16a0c7ca9
  Author: Andy Wingo <address@hidden>
  Date:   Thu Jun 23 21:39:23 2016 +0200

      Fix R6RS fold-left documentation
      
      * doc/ref/r6rs.texi (rnrs lists): Fix documentation of fold-left.

Should be out in 2.1.4.

Cheers,

Andy


--- End Message ---

reply via email to

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