Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Invoke Rules in Source-File
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




Report this thread to moderator Post Follow-up to this message
Old Post
Paul Summer
10-02-04 01:58 PM


Re: Invoke Rules in Source-File
Paul 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.

Report this thread to moderator Post Follow-up to this message
Old Post
Markus Triska
10-02-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Prolog archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:51 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.