Blob


1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname 10.1.1) (read-case-sensitive #t) (teachpacks ((lib "convert.ss" "teachpack" "htdp") (lib "guess.ss" "teachpack" "htdp") (lib "master.ss" "teachpack" "htdp") (lib "draw.ss" "teachpack" "htdp") (lib "hangman.ss" "teachpack" "htdp"))) (htdp-settings #8(#t constructor repeating-decimal #f #t none #f ((lib "convert.ss" "teachpack" "htdp") (lib "guess.ss" "teachpack" "htdp") (lib "master.ss" "teachpack" "htdp") (lib "draw.ss" "teachpack" "htdp") (lib "hangman.ss" "teachpack" "htdp")))))
4 (define PAYPERHOUR 12)
6 Data Definition
7 A list-of-numbers is either
8 1. an empty list or
9 2. (cons n lon) where n is a number and lon is a list-of-numbers.
11 Contract, Purpose, Header
12 wage : number -> number
13 Computes the wage given hours.
15 (define (wage hours)
16 (* PAYPERHOUR hours))
18 Contract, Purpose, Header
19 hours->wages : list-of-numbers -> list-of-numbers
20 Computes the wages (list-of-numbers) from alon.
22 Template
24 (define (hours->wages alon)
25 (cond
26 [(empty?) ...]
27 [else ... (first alon) (rest alon) ...]))