Rewrite the following accumulator function to use foldl.

;; even-trues? : (listof booleans) -> boolean
;; to determine if lob contains an even number of trues.
(define (even-trues? lob)
  (even-trues?/a lob true))

;; even-trues?/a : (listof booleans) boolean -> boolean
;; the accumulator is true if there were an even number of
;; trues seen so far and false if there were an odd number of trues
;; seen so far.
(define (even-trues?/a lob a)
  (cond
    [(empty? lob) a]
    [else (even-trues?/a (rest lob)
                         (cond
                           [(first lob) (not a)]
                           [else a]))]))

;; foldl : (listof X) Y (X Y -> Y) -> Y
(define (foldl l a combine)
  (cond
    [(empty? l) a]
    [else (foldl (rest l) (combine (first l) a) combine)]))

Solution

(define (even-trues? l) 
  (foldl l true (lambda (x y) (not (boolean=? x y)))))