diff options
Diffstat (limited to 'my_list.mli')
-rw-r--r-- | my_list.mli | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/my_list.mli b/my_list.mli index 4644a74..329efba 100644 --- a/my_list.mli +++ b/my_list.mli @@ -75,3 +75,12 @@ let rev_append l1 l2 = let rec flatten = function | Item(hd, tl) -> append hd (flatten tl) | None -> None + +(** Return true if the given elem is contained in the given list. *) +let rec mem elem = function + | Item(hd, tl) -> ( + match hd = elem with + | true -> true + | false -> mem elem tl + ) + | None -> false |