1signature UTF8Set = 2sig 3 4 type t 5 val add : t * string -> t 6 val empty : t 7 val addList : t * string list -> t 8 val isEmpty : t -> bool 9 val listItems : t -> string list 10 val member : t * string -> bool 11 12 val longest_pfx_member : t * string -> {pfx:string,rest:string} option 13 14(* 15 [t] is the type of sets of (UTF8-encoded) strings. The implementation is 16 a trie like structure. If a malformed (in the sense of the UTF8 17 encoding) string is passed to any of these functions then the UTF8.BadUTF8 18 exception will be raised. 19 20 [add(t,s)] adds the string s to the set t. 21 22 [empty] is the empty set. 23 24 [addList(t,slist)] adds the list of strings slist to t. 25 26 [isEmpty t] returns true iff t does not contain any elements. 27 28 [listItems t] returns the list of elements in t. 29 30 [member(t,s)] returns true iff s is a member of t. 31 32 [longest_pfx_member(t,s)] returns SOME{pfx,rest} when pfx is the longest 33 prefix of s that is also a member of t, and rest is the rest of the string 34 s. If there is no prefix of s in t, then the function returns NONE. 35*) 36 37end 38