Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, how can I directly invoke Rules in my Source-File. For example I have the following code: %*************************************** *************** my_Fact1. my_Fact2. alltrue([]). alltrue([Head|Tail]) :- call(Head), alltrue(Tail). addfacts([]). addfacts([Head|Tail]) :- assert(Head), addfacts(Tail). rule(L1, L2) :- (alltrue(L1) -> addfacts(L2) ; true). rule([my_Fact1, my_Fact2], [my_Fact3]). %here is the problem!!! %*************************************** *************** My problem now is, that my rule doesn't work, i.e. when I ask "my_Fact1" I get "yes", but when I ask "my_Fact3" I get "no". If I write "rule([my_Fact1, my_Fact2], [my_Fact3])." directly in the command-line then I can ask for "my_fact3" (yes). So, what can I do to invoke the rule in the source-code like I have described here? Thanks, Paul
Post Follow-up to this messagePaul Summer wrote: > > So, what can I do to invoke the rule in the source-code like I have > described here? > This depends on your implementation. Did you try :- rule([my_Fact1, my_Fact2], [my_Fact3]). already? Best regards, Markus.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.