GNU bug report logs -
#24080
fold-left description in (rnrs lists) section of guile manual incorrect
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24080 in the body.
You can then email your comments to 24080 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#24080
; Package
guile
.
(Tue, 26 Jul 2016 20:16:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Glenn Michaels" <gmichaels <at> Safe-mail.net>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Tue, 26 Jul 2016 20:16:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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).
Reply sent
to
Andy Wingo <wingo <at> pobox.com>
:
You have taken responsibility.
(Thu, 04 Aug 2016 20:41:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Glenn Michaels" <gmichaels <at> Safe-mail.net>
:
bug acknowledged by developer.
(Thu, 04 Aug 2016 20:41:01 GMT)
Full text and
rfc822 format available.
Message #10 received at 24080-done <at> debbugs.gnu.org (full text, mbox):
On Tue 26 Jul 2016 22:15, "Glenn Michaels" <gmichaels <at> Safe-mail.net> 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 <wingo <at> pobox.com>
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
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 02 Sep 2016 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 6 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.