;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname foldll) (read-case-sensitive #t) (teachpacks ((lib "docs.rkt" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "docs.rkt" "teachpack" "htdp")) #f))) (define (foldll g ys u) (if (null? ys) u (foldll g (cdr ys) (g u (car ys))))) (foldll + '(1 2 3 4 5) 0) ; return 15 but computes it differently than foldrr (define (rev xs) (foldll (lambda (x y) (cons y x))xs '())) (rev '(1 2 3 4))