summaryrefslogtreecommitdiff
path: root/src/vylist/vylist.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/vylist/vylist.ml')
-rw-r--r--src/vylist/vylist.ml17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/vylist/vylist.ml b/src/vylist/vylist.ml
new file mode 100644
index 0000000..c7d0396
--- /dev/null
+++ b/src/vylist/vylist.ml
@@ -0,0 +1,17 @@
+let rec find p xs =
+ match xs with
+ | [] -> None
+ | x :: xs' -> if (p x) then (Some x)
+ else find p xs'
+
+let rec remove p xs =
+ match xs with
+ | [] -> []
+ | x :: xs' -> if (p x) then xs'
+ else x :: (remove p xs)
+
+let rec replace p x xs=
+ match xs with
+ | [] -> []
+ | x' :: xs' -> if (p x') then x :: xs'
+ else x' :: (replace p x xs')