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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lists

Status
Not open for further replies.

christioan

Programmer
May 1, 2002
7
AT
How can I create lists and how can I work with them(save new informations in them, search in them)?
Please help, it's important!!!!
 
Hello. Is this suitable as a reply?

%%% show lists

?- listing.
data([hello,world]).
data([hello,london]).
data([good,morning,tokyo]).
yes

%%% enum all lists

?- data(X), write(X).
[hello,world]
X = [hello,world] ;
[hello,london]
X = [hello,london] ;
[good,morning,tokyo]
X = [good,morning,tokyo] ;
no

%%% search

?- data([good|X]), write(X).
[morning,tokyo]
X = [morning,tokyo] ;
no

%%% add

?- assert(data([the, end])).
yes

%%% enum all lists

?- listing.
data([hello,world]).
data([hello,london]).
data([good,morning,tokyo]).
data([the,end]).
yes

%%% exist?

?- data([the, end]).
yes

%%% exist?

?- data([its, start]).
no
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top