Attention needed

Be aware that as guest, programs you create could be edited or deleted by anyone. Register

Length

Guest user
Edit
updated

Calculate a listlength

Prolog files

program
length([], 0).

length([H|T], N) :-
length(T, N1), N is N1+1.
                            

Queries

a list
length([a,b,c], N).
an empty list
length([], N).

Results

Execute a query to get a result