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!

Prolog Printing From KDB

Status
Not open for further replies.

TimmyC1983

Programmer
Nov 18, 2008
2
GB
Hi all,

I am relatively new to using prolog and had a quick question.

I have a KDB with all my data in, split into two dynamics. I was wondering how it would be possible to print each piece of data from the KDB using another .pl file. Thanks in advance,

Tim.
 
Look at this example in SWI-Prolog:
module mod1.pl
Code:
:- module('mod1.pl', [a/1]).

a(1).
a(2).
a(3).

module mod2.pl
Code:
:- module('mod2.pl', [b/1]).

b(10).
b(20).

module test.pl
Code:
:- use_module('mod1.pl').
:- use_module('mod2.pl').
test :-
	write('facts a from module mod1'), nl,
	listing(a),
	write('facts b from module mod2'), nl,
	listing(b).
output :
Console Prolog said:
4 ?- test.
facts a from module mod1
a(1).
a(2).
a(3).

facts b from module mod2
b(10).
b(20).

true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top