diff options
author | Daniil Baturin <daniil@baturin.org> | 2015-04-28 22:35:12 +0600 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-04-28 22:35:12 +0600 |
commit | e2156cbf273d774a43fd3515cab87ac9c4c64c4f (patch) | |
tree | 00ccfce38fb11bb7b3eea6cbf27b5db0b8959e40 /src | |
parent | 9fdd54c2c129fe97b3d96128ca17a787eeeefb3f (diff) | |
download | vyconf-e2156cbf273d774a43fd3515cab87ac9c4c64c4f.tar.gz vyconf-e2156cbf273d774a43fd3515cab87ac9c4c64c4f.zip |
Add Vylist.in_list for quick checks.
Diffstat (limited to 'src')
-rw-r--r-- | src/vylist.ml | 6 | ||||
-rw-r--r-- | src/vylist.mli | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/vylist.ml b/src/vylist.ml index f18801e..dbcf906 100644 --- a/src/vylist.ml +++ b/src/vylist.ml @@ -38,3 +38,9 @@ let complement xs ys = in if List.length xs < List.length ys then aux xs ys else aux ys xs + +let in_list xs x = + let x' = find ((=) x) xs in + match x' with + | None -> false + | Some _ -> true diff --git a/src/vylist.mli b/src/vylist.mli index 9a713b3..2df1c2f 100644 --- a/src/vylist.mli +++ b/src/vylist.mli @@ -4,3 +4,4 @@ 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 in_list : 'a list -> 'a -> bool |