LISP Scheme Part5
■ このスレッドは過去ログ倉庫に格納されています
0476デフォルトの名無しさん
NGNG(define (dotted-for-each f x)
(if (list? x) (for-each f x)
(do ((x x (cdr x))
((not (pair? x)) (f x))
(f (car x)))))
(define (for-each-pair f g pair r)
(cond ((pair? pair) (dotted-for-each (lambda (pair) (for-each-pair f g pair r))
pair))
((null? pair) r)
(else (g (f pair) r))))
■ このスレッドは過去ログ倉庫に格納されています