summaryrefslogtreecommitdiff
path: root/src/vylist.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-03-14 12:57:31 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-03-23 13:42:52 -0500
commit06bfbc2334723b52414b047c6c8f8c18cbc5bda6 (patch)
tree53d42694ccd6b90dcd8d87b271eeacd5cfde9345 /src/vylist.ml
parent334819524a78c920b0184f6f6a99daabf57c520e (diff)
downloadvyos1x-config-06bfbc2334723b52414b047c6c8f8c18cbc5bda6.tar.gz
vyos1x-config-06bfbc2334723b52414b047c6c8f8c18cbc5bda6.zip
T5087: add optional arg for lexical insertion of nodes
Diffstat (limited to 'src/vylist.ml')
-rw-r--r--src/vylist.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vylist.ml b/src/vylist.ml
index cd4a32e..c64dd89 100644
--- a/src/vylist.ml
+++ b/src/vylist.ml
@@ -28,6 +28,12 @@ let rec insert_after p x xs =
| y :: ys -> if (p y) then y :: x :: ys
else y :: (insert_after p x ys)
+let rec insert_compare p x xs =
+ match xs with
+ | [] -> [x]
+ | y :: ys -> if (p x y <= 0) then x :: y :: ys
+ else y :: (insert_compare p x ys)
+
let complement xs ys =
let rec aux xs ys =
match xs, ys with