From 108a30ea79a28b44d6bad6519c4b62e76feee368 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Fri, 10 Oct 2025 03:29:52 +0100 Subject: [PATCH] add utility function to insert from a list into a set --- fcore/search-list/dfa-gen.sml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fcore/search-list/dfa-gen.sml b/fcore/search-list/dfa-gen.sml index 2a73655..6a02e54 100644 --- a/fcore/search-list/dfa-gen.sml +++ b/fcore/search-list/dfa-gen.sml @@ -109,6 +109,16 @@ struct BRANCH (l, newKey, newVal, r) | LEAF => BRANCH (LEAF, newKey, newVal, LEAF) + fun addFromList (lst, tree) = + case lst of + [] => tree + | (k, v) :: tl => + let + val tree = insertOrReplace (k, v, tree) + in + addFromList (tl, tree) + end + fun getOrDefault (findKey, tree, default) = case tree of BRANCH (l, curKey, curVal, r) =>