Why is it that in some functions when I use modules like List.filter it does not return an error: stack overflow
but when I use
let rec filter p l =
match l with
| [] -> []
| hd::tl -> if p hd then hd::(filter p l) else filter p l
which has the same functions as List.filter it produces the stack overflow error