Sunday, 15 January 2012

I wrote some prolog logic, how do I write a script that uses it? -


I am writing an assignment for a prolog class and I'm stuck on something simple I argued in a file named Question 1 Has written a bunch of. Pl

I am using SWI on Mac OS X, so at the command prompt, I do this:

  Swazel Consultation ('Question 1.Pl') < / Code>  

To load the file, then I do this to check:

 ? - Father (Homer, Bart) the truth? - Father (big, Bart). False   

and so on.

My question is, how do I write a "test script" for my code?

I suppose I should write something like Question 1 - tests.pl which looks like this:

  ('write test1 must be correct'). Father (Homer, Bart). ('Write test2, must be incorrect'). Father (Marge, Bart).   

But how do I run that script?

Sorry, I know it's easy, but I'm stuck. Thanks!

Not sure that this is the best way, but you can create a script like this: < / P>

  swipl & lt; & Lt; END [question1] write ('test1 must be true'). Father (Homer, Bart). Write ('test2 should be incorrect'). Father (Marge, Bart). END    

No comments:

Post a Comment