An Extra Exercise

Recall the example from lecture, when we first saw accumulators:

;; bounced-a-check?: lon --> bool
;; given a list of bank transaction and an initial bank balance,
;; tell whether a check might bounce.
;; (A positive transaction means a deposit.)
;;
(define bounced?
  (lambda (bal transacts)
    (cond [(empty? transacts) (negative? bal)]
          [else (or (negative? bal)
                    (bounced? (+ bal (first transacts)) (rest
		    transacts)))])))
This example is a better accumulator example than sum-acc, because it doesn't have an easy non-accumulator version.
  1. Why can't we use make-list-fun-accum for this, as it was written?
  2. Make a more general version of make-list-fun-accum which can express bounced? as a special case.

Back to lab09.
Back to .