Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier
Created December 20, 2012 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabienArcellier/4345937 to your computer and use it in GitHub Desktop.
Save FabienArcellier/4345937 to your computer and use it in GitHub Desktop.
Apply squarred on every element in a list
carre(X, Result) :- Result is X * X.
list_carre([X], [XCarre]) :- carre(X, XCarre).
list_carre([X|R], [XCarre| Result1]):- lcarre(R, Result1), carre(X, XCarre).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment