summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-04-14 16:56:08 +0200
committerLudovic Courtès <ludo@gnu.org>2013-04-14 16:56:08 +0200
commit04fd96cac33fa7557e574e54575252564ba27111 (patch)
tree42f0ca2251cf6effb82b9d38f7789e2ad54842a8 /gnu
parent77ffd691bfbb152cde94b60aa8df5135d39727c3 (diff)
downloadguix-04fd96cac33fa7557e574e54575252564ba27111.tar.gz
utils: Add `fold2'.
* gnu/packages.scm (fold2): Remove.
* guix/utils.scm (fold2): New procedure.  Generalization of the above to
  one and two lists.
* tests/utils.scm ("fold2, 1 list", "fold2, 2 lists"): New tests.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages.scm8
1 files changed, 0 insertions, 8 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index b639541788..f4d93a789d 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -110,14 +110,6 @@
                   (false-if-exception (resolve-interface name))))
               (package-files)))
 
-(define (fold2 f seed1 seed2 lst)
-  (if (null? lst)
-      (values seed1 seed2)
-      (call-with-values
-          (lambda () (f (car lst) seed1 seed2))
-        (lambda (seed1 seed2)
-          (fold2 f seed1 seed2 (cdr lst))))))
-
 (define (fold-packages proc init)
   "Call (PROC PACKAGE RESULT) for each available package, using INIT as
 the initial value of RESULT.  It is guaranteed to never traverse the