srfi-101 reference implementation missing ra:for-each
Per Bothner 17 Oct 2013 19:50 UTC
The reference implementation srfi-101.sls is missing ra:for-each,
even though it is exported. Was it only tested on implementations
that don't catch missing definitions?
Also, ra:list-update is defined but not used or exported.
Here is an implementation or ra:for-each that seems to work
in Kawa (not uses case-lambda):
(define (ra-for-each f . lss)
(cond ((and (pair? lss) (null? (cdr lss)))
(let ((ls (car lss)))
(let recr ((ls ls))
(if (kons? ls)
(begin (tree-for-each f (kons-tree ls))
(recr (kons-rest ls)))))))
(else
;;(check-nary-loop-args 'ra-map (lambda (x) x) f lss)
(let recr ((lss lss))
(if (not (ra-null? (car lss)))
;; IMPROVE ME: make one pass over lss.
(begin
(tree-for-each/n f (map kons-tree lss))
(recr (map kons-rest lss))))))))
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/