help for excersise 5.13

rock dwan rock_dwan@hotmail.com
Wed, 10 Oct 2001 15:45:29 +1300


i have done the function for borrowers but having some trouble with the 
borrowed and numBorrowed function. I have listed my code below with the 
borrowed function not completed and numBorrowed also not completed.Can you 
plz try to fill in the borrowed and numBorrowed functions if you can

THANKS.

type Database = [(Person,Book)]
type Person = String
type Book   = String

exampleBase :: Database
exampleBase

  = [("Alice","Tintin"),("Anna","little 
Women"),("Alice","Asterix"),("Rory","Tintin")]

borrowers :: Database -> Book -> [Person]
borrowers db findBook
= [person|(person,bks)<-db,bks==findBook]

borrowed :: Database -> Book -> Bool
borrowed db bookName



numBorrowed :: Database -> Person -> Int


reference from the craft of func programming second edition book page 84 and 
87



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp