Hi,

First, let me point out that I long ago stopped making any claims that
Jess was a workalike for CLIPS. In general, things like I/O do work
differently.

I'm assuming that you're actually typing these rules in at the Jess>
prompt (using either jess.Main or jess.Console), That's important,
because what's happening is that both the code and the runtime input
are coming from the same place; that's the only case where this
matters. 

The problem is that when you type

Jess> (run)<Enter>

There's a newline after the (run) function call from when you press
<Enter> and the first (readline) call returns that newline. That's
just how things work in Jess, sorry. This problem won't occur in a
real system because no one would type all the rules in each time they
wanted to run them; they'd put the rules in a file. If you put the
rules in a file and use (batch), or if you start jess.Main as "java
jess.Main file.clp", then the rules and the runtime input are coming
from two different places, so there's no interference.

Before you decide that this is "wrong", try an experiment: what does
this line do in Jess if you type it at the command line? 

(defrule foo => (printout t fire crlf)) (reset) (run)

What does it do in a batch file? That's right; in both cases, it
prints "fire".

Now try the same thing in CLIPS. In both cases, it just defines the
rule, and doesn't run it. CLIPS ignores everything on a line of input
after the first complete expression. Which do you like better? Which
is more surprising?


I think Abdul Gaffar wrote:
> 
> Greetings
> 
> I am having problems trying to execute my code in JESS. The code works fine 
> under CLIPSWIN, but if I try and run it in JESS then I get strange 
> behaviour. For example when program is run, it should ask the questions ONE 
> AT A TIME instead of having both questions asked together. The code snippet 
> for the startup rule is shown below.
> 
> (defrule startup "define initial WME's created by (reset) "
> =>
> (printout t "Welcome to the diagnosis program   " crlf)
> (printout t "The system will ask you a series of questions " crlf)
> (printout t "to which you need to answer Y or N       " crlf)
> 
> (printout t "Have you experience any swelling ? (Y or N):   ")
> (assert (goal
>       (type swelling)
>       (value (readline))))    <--Should ask this and wait for response. Instead 
> it displays this 1st question and diplays the statement below simultaneously 
> and waits for user input there. I dont see why it does this.
> 
> (printout t "Have you been injured recently ? (Y or N):   ")
> (assert (goal
>       (type injury)
>       (value (readline)))))
> 
> Can anyone help as its doing my head in.. Just doesnt make any sense at all. 
> Is this a Bug in JESS??
> 
> Here  is the output from running the code.
> *****************
> Welcome to the diagnosis program
> The system will ask you a series of questions
> to which you need to answer Y or N
> Have you experience any swelling ? (Y or N):   Have you been injured 
> recently ? (Y or N):
> 
> ******************************************
> 
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to