(* completion.sml *) (* Copyright (C) 2006 Alley Stoughton This file is part of crypto, a cryptogram encoder/decoder. See the file COPYING.txt for copying and usage restrictions *) structure Completion :> COMPLETION = struct datatype result = None | Unique of string | Ambiguous fun complete xs y = case List.filter (String.isPrefix y) (StringSet.toList xs) of nil => None | [z] => Unique z | _ => Ambiguous end;