diff --git a/src/ikarus.boot b/src/ikarus.boot index 138f8e4..b18387d 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ diff --git a/src/ikarus.lists.ss b/src/ikarus.lists.ss index bec051a..79f1948 100644 --- a/src/ikarus.lists.ss +++ b/src/ikarus.lists.ss @@ -536,7 +536,27 @@ (void) (error who "length mismatch"))] [else (error who "not a list")])] - [_ (error who "vararg not supported yet")]))) + [(f ls . ls*) + (unless (procedure? f) + (error 'for-each "~s is not a procedure" f)) + (unless (list? ls) + (error 'for-each "~s is not a list" ls)) + (let ([n (length ls)]) + (for-each + (lambda (x) + (unless (and (list? x) (= (length x) n)) + (error 'for-each "~s is not a list" x))) + ls*) + (let loop ([n (length ls)] [ls ls] [ls* ls*]) + (cond + [($fx= n 0) + (unless (and (null? ls) (andmap null? ls*)) + (error 'for-each "list modified by ~s" f))] + [else + (unless (and (pair? ls) (andmap pair? ls*)) + (error 'for-each "list modified by ~s" f)) + (apply f (car ls) (map car ls*)) + (loop (fx- n 1) (cdr ls) (map cdr ls*))])))]))) (module (andmap) (define who 'andmap) diff --git a/src/todo-r6rs.ss b/src/todo-r6rs.ss index b92096e..73ba089 100755 --- a/src/todo-r6rs.ss +++ b/src/todo-r6rs.ss @@ -151,7 +151,7 @@ [expt C ba se] [finite? S ba] [floor C ba se] - [for-each S ba se] + [for-each C ba se] [gcd C ba se] [imag-part D ba se] [inexact C ba] @@ -503,7 +503,7 @@ [assp S ls] [assq C ls se] [assv C ls se] - [cons* S ls] + [cons* C ls] [filter S ls] [find S ls] [fold-left S ls]