(* DICTPLUS is a signature that describes a dictionary with all the * types and values from DICT, plus two additional values. It is * implemented by the DictPlusFn functor below. *) signature DICTPLUS = sig (* A DICTPLUS should do everything DICT does. *) include DICT (* Predicate telling whether a given string is bound. *) val isBound : 'a dict * string -> bool (* Given a dictionary and two lists (of equal length), binds each string to the corresponding 'a pairwise in the resulting dictionary. Using functions from Warmup, this can be done in two lines (with no recursion!). *) val bindList : 'a dict * string list * 'a list -> 'a dict end (* This functor implements DICTPLUS given any structure Dict : DICT. * That is, you should be able to write either of: * * structure AListDictPlus = DictPlusFn (AListDict) * structure FunDictPlus = DictPlusFn (FunDict) * * and get a working DICTPLUS. *) functor DictPlusFn (Dict : DICT) :> DICTPLUS = struct structure D = Dict (* Abbreviation for Dict *) type 'a dict = 'a D.dict val empty = D.empty val bind = D.bind val lookup = D.lookup (* Define isBound and bindList here. *) end