structure PersonDB = struct exception PersonNotFound type DBKeys = { Name : string, Age : int, Address : string } type PersonRecord = { Info: DBKeys } type StaffEmployee = { Info: DBKeys, HourlyWage: int, EmploymentStatus : int } type Programmer = { Info: DBKeys, Salary: int, Step: int } type Manager = { Info: DBKeys, Salary: int, Step: int, Supervisees: int } datatype 'x Database = EmptyDB | Body of 'x list (*with*) fun AddPerson(EmptyDB, p) = Body([p]) | AddPerson(Body(b), p) = Body(b @ [p]) fun FindPerson(EmptyDB, p) = raise PersonNotFound | FindPerson(Body((p as {Info={Name=n, ...}, ...}) :: ps), (p1 as {Info={Name=n1 (r as ,...)}, (rr as...)})) = (* if true then *) (* if #Name(#Info(hd(b))) = #Name(#Info(p)) then *) (* if Name(Info(hd(b))) = Name(Info(p)) then *) if n = n1 then {Info={Name=n1, r}, rr} else FindPerson(Body(ps), {Info={Name=n1, r}, rr}) (*end*) end