(* * This file contains an assoc function equivalent to that in alist.ml, but * here the definition of assoc is pattern based. *) fun assoc(key, nil) = ("", 0) | assoc(key, al::als) = if key = #1(al) then al else assoc(key, als); (* * Simple tests of the alist functions. *) val a = [("x",10),("y",20),("z",30)]; #2(assoc("x", a)); #2(assoc("z", a)); #2(assoc("w", a));