Re: srfi-101 reference implementation missing ra:for-each
David Van Horn 17 Oct 2013 20:25 UTC
On 10/17/13 3:50 PM, Per Bothner wrote:
> 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))))))))
>
I see for-each in the reference implementation and test suite.
You're right about list-update, though. That's a bug.
David