Wednesday, February 21, 2024

Find the number of elements of a list.

 

Find the number of elements of a list.

my_length([],0).

my_length([_|L],N) :- my_length(L,N1), N is N1 + 1.

No comments:

Post a Comment