From c18c12f1975c2ad79ccdf0d59040148830ac0b68 Mon Sep 17 00:00:00 2001 From: koba-e964 Date: Thu, 16 Jul 2015 21:36:47 +0900 Subject: [PATCH] Fix functions pair-fold-right, any, and every in contrib/40.srfi/srfi/1.scm --- contrib/40.srfi/srfi/1.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/contrib/40.srfi/srfi/1.scm b/contrib/40.srfi/srfi/1.scm index 8859b06b..7a849071 100644 --- a/contrib/40.srfi/srfi/1.scm +++ b/contrib/40.srfi/srfi/1.scm @@ -315,8 +315,7 @@ (let rec ((clist clist) (cont values)) (if (null? clist) (cont knil) - (let ((tail (map cdr clists))) - (rec tail (lambda (x) (cont (kons clist x))))))) + (rec (cdr clist) (lambda (x) (cont (kons clist x)))))) (let rec ((clists (cons clist clists)) (cont values)) (if (every pair? clists) (let ((tail (map cdr clists))) @@ -497,11 +496,11 @@ (define (any pred clist . clists) (if (null? clists) (let rec ((clist clist)) - (if (pair? clist) + (and (pair? clist) (or (pred (car clist)) (rec (cdr clist))))) (let rec ((clists (cons clist clists))) - (if (every pair? clists) + (and (every pair? clists) (or (apply pred (map car clists)) (rec (map cdr clists))))))) @@ -510,11 +509,11 @@ (if (null? clists) (let rec ((clist clist)) (or (null? clist) - (if (pred (car clist)) + (and (pred (car clist)) (rec (cdr clist))))) (let rec ((clists (cons clist clists))) (or (any null? clists) - (if (apply pred (map car clists)) + (and (apply pred (map car clists)) (rec (map cdr clists)))))))) (define (list-index pred clist . clists)