summaryrefslogtreecommitdiff
path: root/my_list.mli
diff options
context:
space:
mode:
Diffstat (limited to 'my_list.mli')
-rw-r--r--my_list.mli12
1 files changed, 2 insertions, 10 deletions
diff --git a/my_list.mli b/my_list.mli
index 0f5b71a..09a8b5e 100644
--- a/my_list.mli
+++ b/my_list.mli
@@ -78,19 +78,11 @@ let rec flatten = function
(** 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
- )
+ | Item(hd, tl) -> hd = elem || mem elem tl
| None -> false
(** Return true if the given elem is contained in the given list. Same as
* my_list.mem but uses physical equality. *)
let rec memq elem = function
- | Item(hd, tl) -> (
- match hd == elem with
- | true -> true
- | false -> memq elem tl
- )
+ | Item(hd, tl) -> hd == elem || memq elem tl
| None -> false