Skip to content

Instantly share code, notes, and snippets.

@trietptm
Created December 11, 2012 09:30
Show Gist options
  • Save trietptm/4257305 to your computer and use it in GitHub Desktop.
Save trietptm/4257305 to your computer and use it in GitHub Desktop.
Find the number of elements of a list.
number_elements_of_list(0, []).
number_elements_of_list(X, [H|T]) :- number_elements_of_list(X1, T), X is X1+1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment