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-intermediate-reader.ss" "lang")((modname 17.3.0) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "dir.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "dir.ss" "teachpack" "htdp")))))
4 (define-struct phone-record (name number))
6 ;A phone-record is a structure
7 ;(make-phone-record s n)
8 ;where s is a symbol and n is a number.
10 ;A list-of-symbols is either
13 ;where s is a symbol and los is a list-of-symbols.
15 ;A list-of-numbers is either
18 ;where n is a number and lon is a list-of-numbers.
20 ;A list-of-phone-records is either
23 ;where pr is a phone-record and lopr is a list-of-phone-records.
25 ;zip : list-of-symbols list-of-numbers -> list-of-phone-records
26 ;Given los (list-of-symbols representing a list of names) and lon (list-of-numbers representing a list of phone numbers), produces a list-of-phone-records.
27 ;ASSUMPTION: Both lists are assumed to be of the same length.
32 [(cons? los) (cons (make-phone-record (first los) (first lon))
33 (zip (rest los) (rest lon)))]))
35 (define list-names '(Joe Sam Bill Hank Frank Ronald))
36 (define list-numbers '(595 393 232 521 423 094))
37 (zip list-names list-numbers)