In the last chapter we represented a phone book as a list of the form:
(person phone-number person phone-number ...)
This representation caused us some problems, because some elements of the list are names and some are phone numbers. It would be easier to write functions that use the phone book if the structure were more uniform.
Thus, instead of a flat list:
(person phone-number person phone-number ...)
we use an association list:
((person phone-number) (person phone-number) ...)
Each element of an association list contains a key and the associated value. In a phone book, the key is the person and the value is the phone number.
(define phone-book '((barbara 775-1234) (luke 774-2839) (nick 775-0912) (valerie 775-9043)))
Example:
(old->new '(nick 775-0912 valerie 775-9043))((nick 775-0912) (valerie 775-9043))
(old->new '())()
(phone-number 'valerie (old->new '(nick 775-0912 valerie 775-9043)))775-9043