Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier
Created December 14, 2012 15:39
Show Gist options
  • Select an option

  • Save FabienArcellier/4286323 to your computer and use it in GitHub Desktop.

Select an option

Save FabienArcellier/4286323 to your computer and use it in GitHub Desktop.
Create menu with price and calories associate with it
entree(salade, 5, 400).
entree(taboulee, 3, 300).
plat(andouillette, 8, 500).
plat(steak, 10, 900).
fromage(bri, 3, 150).
fromage(camembert, 4, 300).
dessert(tarte, 5, 320).
dessert(flan, 4, 120).
menu(X, Y, Z, Prix, Calorie) :- entree(X, P1, C1), plat(Y, P2, C2), dessert(Z, P3, C3), Prix is P1+P2+P3, Calorie is C1+C2+C3.
menu(X, Y, Z, Prix, Calorie) :- entree(X, P1, C1), plat(Y, P2, C2), fromage(Z, P3, C3), Prix is P1+P2+P3, Calorie is C1+C2+C3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment