Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier
Created December 20, 2012 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabienArcellier/4345818 to your computer and use it in GitHub Desktop.
Save FabienArcellier/4345818 to your computer and use it in GitHub Desktop.
Calculate a factoriel using prolog
fact(0,1).
fact(1,1).
fact(X, Result):- X > 1, X1 is X-1, fact(X1, Result1), Result is Result1 * X.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment