diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2018-07-12 20:02:05 +0200 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2018-07-12 20:02:05 +0200 |
commit | 80ef1158cc0ec28cb56721900a458c5cdc9a5357 (patch) | |
tree | 1a2f80e441cd1ce0a476cee1b078aa71800686a0 /my_list.mli | |
parent | 20cf9db70e399954821ec1fc9bc0983d34a7682a (diff) |
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'my_list.mli')
-rw-r--r-- | my_list.mli | 12 |
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 |