add 'fromList' convenience function

This commit is contained in:
2024-09-04 08:16:56 +01:00
parent 38b534d935
commit 7a4a99a408

View File

@@ -420,5 +420,11 @@ struct
fun addList (lst, trie) =
List.foldl helpAddList trie lst
val trie = let val trie = fromString "hello" in addList (["bye"], trie) end
fun fromList (hd :: tl) =
let val trie = fromString hd
in addList (tl, trie)
end
| fromList ([]) = raise Empty
val trie = fromList ["hello"]
end