combinators: Recurse fold2 to named let loop.

* guix/combinators.scm (fold2): Recurse to named let loop, not fold2 itself.

Signed-off-by: Jakub Kądziołka <kuba@kadziolka.net>
This commit is contained in:
Arun Isaac 2020-06-01 05:41:13 +05:30 committed by Jakub Kądziołka
parent fabfe0b99c
commit 7a99c58c45
No known key found for this signature in database
GPG key ID: E315A75846131564

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -56,7 +57,7 @@ (define fold2
(call-with-values (call-with-values
(lambda () (proc (car lst1) (car lst2) result1 result2)) (lambda () (proc (car lst1) (car lst2) result1 result2))
(lambda (result1 result2) (lambda (result1 result2)
(fold2 proc result1 result2 (cdr lst1) (cdr lst2))))))))) (loop result1 result2 (cdr lst1) (cdr lst2)))))))))
(define (fold-tree proc init children roots) (define (fold-tree proc init children roots)
"Call (PROC NODE RESULT) for each node in the tree that is reachable from "Call (PROC NODE RESULT) for each node in the tree that is reachable from