exercise-39.scm (541B)
1 ;; Exercise 2.39 2 3 (define (exercise-2.39) 4 (define (reverse-my-fold-right sequence) 5 (my-fold-right 6 (lambda (x y) 7 (append y 8 (list x))) 9 '() 10 sequence)) 11 12 (define (reverse-my-fold-left sequence) 13 (my-fold-left 14 (lambda (x y) 15 (append (list y) 16 x)) 17 '() 18 sequence)) 19 20 (test-begin "2.39") 21 (test-equal 22 '(4 3 2 1) 23 (reverse-my-fold-right '(1 2 3 4))) 24 (test-equal 25 '(4 3 2 1) 26 (reverse-my-fold-left '(1 2 3 4))) 27 (test-end "2.39")) 28 29 (exercise-2.39)