Re: SWI - passing variable value across rules
- From: newser.bbs@xxxxxxxxxxxxxxxxx
- Date: 21 May 2006 20:07:40 -0700
muthu_u@xxxxxxxxx wrote:
....
go:- writeq('Please provide a file name'),
read(File),
assertz(file(File)),
isrelatedto(File,Name),
writeq(Name),writeq('Want more? Type yes or no'),read(Choice),
writeq('Want to add new facts? Type yes or no'),read(Choice2),
assertz(sechoice(Choice2)),
choice(Choice).
choice(yes):-isrelatedto(file(File),Name),choice2(sechoice(X)).
choice(no):-writeq('Thank you for using the
system'),choice2(sechoice(X)).
choice2(yes):-writeq('Please enter file
As a Turbo Prologer , I pay attention more in the Type
than an ISO prologer . And I get some questions in
your codes:
What is the type of the parameter of choice2/1 ?
You use choice2(sechoice(X)) in go/0, then it seems
the parameter is of the type of true or fail. But you
use "yes" in the above line as one of the possible value,
why do you do that ?
I suggest the following codes:
---------------------------------------------------------------------
choice(yes):-isrelatedto(file(File),Name),choice2.
....
choice2:-sechoice(yes),...
choice2:-sechoice(no),...
....
----------------------------------------------------------------------
I know I am silly in prolog , as someone in group always says
so, but I'd still like to share my opinion with you IN DETAILS.
Please don't laugh at me if I say anything wrong.
name'),read(Newfile),writeq('Please enter connected to
entity'),read(Connectedto),assertz(isrelatedto2(Newfile,Connectedto)).
choice2(no):-writeq('Thank you for using the system').
***********************************************
choice2(sechoice(X)) never seems to get translated to choice2(yes) or
choice2(no). However, isrelatedto(File,Name) which appears in the go
rule is correctly getting converted based on user input.
Any help is appreciated.
Sincerely,
Muthukumar. U.
.
- References:
- SWI - passing variable value across rules
- From: muthu_u
- SWI - passing variable value across rules
- Prev by Date: Re: SWI - passing variable value across rules
- Next by Date: Re: SWI - passing variable value across rules
- Previous by thread: Re: SWI - passing variable value across rules
- Next by thread: Re: SWI - passing variable value across rules
- Index(es):