I have created a list of lists, for example:
list1 = [[1; 2]; [3; 4]]
I'm trying to create a function "is_element", which would return true if intiger is in the list, and false otherwise.
How should it work:
is_element list1 4;;
- : bool = true
What I tried:
let rec is_element x = function
[[]] -> false
| [(a:int)::l] -> (a:int) == x || is_element x [l];;
I do get a warning and this function doesn't seem to work.