Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. GNU Prolog - Seems very simple

GNU Prolog - Seems very simple

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
questionlearning
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aab19902
    wrote on last edited by
    #1

    Didn't know where else to post this because prolog doesn't have its own forum. Since it is part of GNU I decided to give this forum a shot. I have a program and need to show that i can run the correct Queries...Having no knowledge of syntax i can't really understand any tutorials. Heres the program.. d(iron, steam). d(pumps, mines). d(mines, railroads). d(iron, railroads). d(iron, guns). d(electricity, aluminum). d(iron, electricity). d(aluminum, jumbojet). d(writing, printingpress). d(printingpress, comicbook). d(iron, printingpress). d(aluminum, printingpress). depends(X,Y) :- d(X,Y). depends(X, Y) :- d(X, Z), depends(Z, Y). Here are the questions... What do you need to invent the comic book? What do you need to invent electricity? If you don't have steam engines, what can you not invent? Given aluminum and electricity, what can you invent? Which inventions are dependent on iron?

    F 1 Reply Last reply
    0
    • A aab19902

      Didn't know where else to post this because prolog doesn't have its own forum. Since it is part of GNU I decided to give this forum a shot. I have a program and need to show that i can run the correct Queries...Having no knowledge of syntax i can't really understand any tutorials. Heres the program.. d(iron, steam). d(pumps, mines). d(mines, railroads). d(iron, railroads). d(iron, guns). d(electricity, aluminum). d(iron, electricity). d(aluminum, jumbojet). d(writing, printingpress). d(printingpress, comicbook). d(iron, printingpress). d(aluminum, printingpress). depends(X,Y) :- d(X,Y). depends(X, Y) :- d(X, Z), depends(Z, Y). Here are the questions... What do you need to invent the comic book? What do you need to invent electricity? If you don't have steam engines, what can you not invent? Given aluminum and electricity, what can you invent? Which inventions are dependent on iron?

      F Offline
      F Offline
      fabrice leal
      wrote on last edited by
      #2

      try this: ?- depends(X,comicbook) ?- depends(X,electricity) (no clue about "If you don't have steam engines, what can you not invent?") :doh: ?- depends(aluminum, Y), depends(electricity,X) ?- depends(iron,Y) PS: I assume that depends(X,Y) means that, with X, you can make Y

      modified on Tuesday, April 14, 2009 11:53 AM

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups