Program-A
trace
domains
City,State=string
predicates
go
location(City,State)
chkstate(State)
clauses
go:-
writef("%-10
%2\n","City","State"),
fail.
go:-
location(City,State),
chkstate(State),
writef("%-10
%2",City,State),
nl,
fail.
go.
location("jackson","ms").
location("washington","dc").
location("ahmedabad","guj").
chkstate("dc"):-
!,
fail.
chkstate(_).
Program-B
domains
City,State=string
predicates
go
location(City,State)
chkstate(State)
clauses
go:-
writef("%-10
%2\n","City","State"),
fail.
go:-
location(City,State),
chkstate(State),
writef("%-10
%2",City,State),
nl,
fail.
go.
location("jackson","ms").
location("washington","dc").
location("ahmedabad","guj").
chkstate("dc"):-
!,
fail.
chkstate(_).


No comments:
Post a Comment