I found the solution to this problem, but it does not work properly.
What is wrong? I always get the result 0.
num([]) -> 0;
num(NUMS) ->
num(NUMS, 0).
num([H|L], Count) when H < 1 -> %% use of guard
num(L, Count+1);
num([_|L], Count) ->
num(L, Count);
num([], Count) ->
Count.
This is an example of use enter image description here
//Edit I found where is problem. This is correct code.
num([]) -> 0;
num(NUMS) ->
num(NUMS, 0).
num([H|L], Count) when H < 1 -> %% use of guard
num(L, Count+1);
num([_|L], Count) ->
num(L, Count+1);
num([], Count) ->
Count.