;; Fold a function over a list; right-associative ;; (foldr fn init lst) ;; ==> (fn (car lst) (foldr fn init (cdr lst))) ; (define (foldr fn init lst) ; (if (pair? lst) ; (fn (car lst) ; (foldr fn init (cdr lst))) ; init)) #0=#S(#="lambda" ; (define (foldr fn init lst) ; ((if (pair? lst) ; (lambda () (fn (car lst) ; (foldr fn init (cdr lst)))) ; (lambda () init)))) #( #S(#="template" ; (lambda () ; (let/cc k ; (let ([lstcar (car lst)]) ; (call-with-multiple-values ; (lambda (v) (k (fn lstcar v))) ; (lambda () (foldr fn init (cdr lst))))))) #( #S(#="template" ; (lambda (v) (k (fn lstcar v))) #() "\x40\x81\xfe\xff" ; i0 f1 ctx k 1 "\x00\x80\x03\xfb\; (set! f0 (car argv)) \x02\x80\x80\x00\; (set! f0 (cons f0 nil)) \x02\x80\x41\x80"; (set! f0 (cons i1 f0)) "\x40\x80\x00\x00\x42\x43" ) #=0 ; foldr ) "\x80\x81\x82" ; f0=fn f1=init f2=lst 3 "\x00\x80\x04\x42\; (set! f0 (cdr i2)) \x00\x81\x03\x42\; (set! f1 (car i2)) \x02\x82\x80\x00\; (set! f2 (cons f0 nil)) \x02\x82\x41\x82\; (set! f2 (cons i1 f2)) \x02\x82\x40\x82"; (set! f2 (cons i0 f2)) "\x02\x82\x00\x00\xfe\x01" ) ) #() 6 "\x00\x80\x03\xfb\; (set! f0 (car argv)) ; f0=fn \x00\x82\x04\xfb\; (set! f2 (cdr argv)) \x00\x81\x03\x82\; (set! f1 (car f2)) ; f1=init \x00\x82\x04\x82\; (set! f2 (cdr f2)) \x00\x82\x03\x82\; (set! f2 (car f2)) ; f2=lst \x00\x84\x01\x01\; (set! f4 g1) \x00\x85\x01\x00\; (set! f5 nil) \x00\x83\x0b\x82\; (set! f3 (pair? f2)) \x40\x83\x00\x00\; (goto-end-if f3) \x00\x84\x01\xff\; (set! f4 k) \x02\x85\x81\x00"; (set! f5 (cons f1 nil)) "\x84\x85\x00\x00\xfe\xff" ) ; vim:set syntax= sw=2 expandtab: