diff options
Diffstat (limited to 'my_list.mli')
-rw-r--r-- | my_list.mli | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/my_list.mli b/my_list.mli index 329efba..0f5b71a 100644 --- a/my_list.mli +++ b/my_list.mli @@ -84,3 +84,13 @@ let rec mem elem = function | false -> 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 + ) + | None -> false |