summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-09-21 08:46:39 +0600
committerDaniil Baturin <daniil@baturin.org>2015-09-21 08:46:39 +0600
commita13e17bbbb81e848be72749bec4fb41155aa7514 (patch)
tree5dd208b4fb71d64e92b99127e69fcb2f97d8d0a3
parente16eed718dacb83e49fa72caecb82ba6820bcced (diff)
downloadvyconf-a13e17bbbb81e848be72749bec4fb41155aa7514.tar.gz
vyconf-a13e17bbbb81e848be72749bec4fb41155aa7514.zip
Make Vylist.complement return a list rather than list option.
Situations when two lists are the same and when they don't have a common part become indistinguishable, but that's rarely needed.
-rw-r--r--src/vylist.ml4
-rw-r--r--src/vylist.mli2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/vylist.ml b/src/vylist.ml
index dbcf906..8ee1e19 100644
--- a/src/vylist.ml
+++ b/src/vylist.ml
@@ -31,10 +31,10 @@ let rec insert_after p x xs =
let complement xs ys =
let rec aux xs ys =
match xs, ys with
- | [], _ -> Some ys
+ | [], _ -> ys
| _, [] -> assert false (* Can't happen *)
| p :: ps, q :: qs -> if p = q then aux ps qs
- else None
+ else []
in
if List.length xs < List.length ys then aux xs ys
else aux ys xs
diff --git a/src/vylist.mli b/src/vylist.mli
index 2df1c2f..9135bf6 100644
--- a/src/vylist.mli
+++ b/src/vylist.mli
@@ -3,5 +3,5 @@ val remove : ('a -> bool) -> 'a list -> 'a list
val replace : ('a -> bool) -> 'a -> 'a list -> 'a list
val insert_before : ('a -> bool) -> 'a -> 'a list -> 'a list
val insert_after : ('a -> bool) -> 'a -> 'a list -> 'a list
-val complement : 'a list -> 'a list -> 'a list option
+val complement : 'a list -> 'a list -> 'a list
val in_list : 'a list -> 'a -> bool