summaryrefslogtreecommitdiff
path: root/src/vytree.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/vytree.ml')
-rw-r--r--src/vytree.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vytree.ml b/src/vytree.ml
index bd73776..ace587b 100644
--- a/src/vytree.ml
+++ b/src/vytree.ml
@@ -88,6 +88,10 @@ let rec insert ?(position=Default) ?(children=[]) node path data =
let s = Printf.sprintf "Non-existent intermediary node: \'%s\'" name in
raise (Insert_error s)
+let insert_maybe ?(position=Default) node path data =
+ try insert ~position:position node path data
+ with Duplicate_child -> node
+
let sorted_children_of_node cmp node =
let names = list_children node in
let names = List.sort cmp names in