Use one of the loops on page 313 [HtDP] to revise each of the following three function definitions:

  1. The function add-taxes adds 5.5% to each amount in a list of bills.

    (define-struct bill (item amount))
    ;; A Bill is: 
    ;; -- (make-bill Symbol Number)
    
    ;; add-taxes : Listof[Bill] -> Listof[Bill]
    (define (add-taxes lob) 
      (cond
        [(empty? lob) empty]
        [else (cons (make-bill 
                      (bill-item (first lob))
                      (* 1.055 (bill-amount (first lob))))
                    (add-taxes (rest lob)))]))
    
    
    ;; Tests: 
    (equal? (add-taxes (list (make-bill 'apple 1.00))) 
            (list (make-bill 'apple 1.055)))
    
    

    Solution

    (define (add-taxes lob) 
      (local ((define (add b) ;; -- [PT 1 for correct add]
                (make-bill (bill-item b) (* 1.055 (bill-amount b)))))
        (map add lob))) ;; -- [PT 1 for correct choice of loop]