Skip to content

Instantly share code, notes, and snippets.

@DonaldKellett
Created December 23, 2018 05:47
Show Gist options
  • Save DonaldKellett/a928d758d870079a491e2c0ed2322a5c to your computer and use it in GitHub Desktop.
Save DonaldKellett/a928d758d870079a491e2c0ed2322a5c to your computer and use it in GitHub Desktop.
Learn Prolog Now! - Chapter 6 - Exercise 6.4.2 - Last element of a list using recursion
last([X], X).
last([_ | T], X) :- last(T, X).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment