From eb92e7771995547cdb866b4162c3bfe01b3bdd9f Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 20 Dec 2016 12:23:10 +0100 Subject: [PATCH] Bugfix: for-each with two lists. * module/mes/scm.mes (for-each): Fix for two lists. Always return *unspecified*. --- module/mes/scm.mes | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/module/mes/scm.mes b/module/mes/scm.mes index db4f6610..433ddd41 100644 --- a/module/mes/scm.mes +++ b/module/mes/scm.mes @@ -132,10 +132,8 @@ (member x (cdr lst))))) (define (for-each f l . r) - (if (null? l) '() ;; IF - (if (null? r) (begin (f (car l)) (for-each f (cdr l))) - (if (null? (cdr r)) - (for-each f (cdr l) (cdar r)))))) + (if (pair? l) (if (null? r) (begin (f (car l)) (for-each f (cdr l))) + (if (null? (cdr r)) (begin (f (car l) (caar r)) (for-each f (cdr l) (cdar r))))))) (define (<= . rest) (or (apply < rest)