All pastes #187372 Raw Edit

Someone

public text v1 · immutable
·published 2006-10-01 00:57 UTC
rendered paste body
; question 2

;; count-the-loot : list -> number
;; returns the total taxes paid by a given
;; payroll list
;; *******uses functions from taxes.ss******
(define (count-the-loot pyrl)
  (cond
    [(empty? pyrl) 0]
    [else (+ (tr-amount (sr-to-tr (first pyrl))) (count-the-loot (rest pyrl)))]))

;; election-year-giveaway : list number -> list
;; returns a payroll with all salaries increased
;; by a given percentage from a given payroll list
(define (election-year-giveaway pyrl boost)
  (cond
    [(empty? pyrl) empty]
    [else (cons (* (sr-salary (first pyrl)) (+ 1 (/ boost 100))) (election-year-giveaway (rest pyrl) boost))]))

;; eat-the-rich : list -> list
;; returns a payroll list with all those people
;; earning $120,000 or more removed from a 
;; given payroll list
(define (eat-the-rich pyrl)
  (cond
    [(empty? pyrl) empty]
    [else (cond
            [(< (sr-salary (first pyrl)) 120000)
             (cons (first pyrl) (eat-the-rich (rest pyrl)))]
            [else (eat-the-rich (rest pyrl))])]))