Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Explain me How Prolog Learn? Please¡ 1

Status
Not open for further replies.

puntito

Programmer
Mar 22, 2006
18
I already wrote my rules and goals and everything works. But I need to understand How the Program learn new facts? How can the user add new information?

This is the fact.
state( state_name, abbreviation, capital_city, area, population, [cities] ).
What if the user wants to add information about important characters of each state.
Or if the population grow, how the user can update that fact.
 
How is it now?

?- hello(X).
no

?- asserta(hello(world)).
yes

?- asserta(hello(japan)).
yes

?- hello(X).
X = japan ;
X = world ;
no

?- retract(hello(world)).
yes

?- hello(X).
X = japan ;
no

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top