exam10.1.1

191阅读 0评论2011-11-18 maunix
分类:LINUX

  1. ;; mht created on Nov 15, 2011

  2. ;; hours->wages : list-of-numbers -> list-of-numbers
  3. ;; to create a list of weekly wages from a list of weekly hours (alon)
  4. (define (hours->wages alon)
  5.   (cond
  6.     [(empty? alon) empty]
  7.     [else (cons (wage (first alon)) (hours->wages (rest alon)))]))

  8. ;; wage : number -> number
  9. ;; to compute the total wage (at $12 per hour)
  10. ;; of someone who worked for h hours
  11. (define (wage h)
  12.   (* 14 h))

  13. ;; hours->wages
  14. (hours->wages (cons 40 (cons 28 empty)))
上一篇:exam9.5.8
下一篇:exam10.1.2