I'm doing some exercise in "List" and "Match-With" but I'm a little stuck.
The exercise tell me Program the upper l x
function that counts all the elements larger than x in the list
Example :
upper [10;20;30;40;50] 35;
the results is 2
.
I did this :
let rec upper x l1 =
match l1 with
|[] -> 0
|[a] -> if (a>x) then 1 else 0
|(a::r) when a>x -> +1
|(a::r) when a<x -> upper x r
but nothings work.