Clear cannot continue!

43 views
Skip to first unread message

Nima

unread,
May 26, 2012, 9:36:26 AM5/26/12
to CLIPSESG
Hi all,

In my CLIPS program, if a rule was correct, I want print a message and
then clear CLIPS environment.
But wen I use (clear) command, this error occur:
[CONSTRCT1] Some constructs are still in use. Clear cannot continue.

Thanks for your help.
Nima

CLIPS Support

unread,
May 27, 2012, 11:23:48 PM5/27/12
to CLIPSESG
You can't clear the environment while CLIPS is running.

markc

unread,
May 28, 2012, 12:35:53 AM5/28/12
to CLIPSESG
The only effective way that you could do this is from within an
external appliation calling clips. You would run the CLIPS engine in
a single step fashion within a loop. In your CLIPS code where you
wanted to put the Clear command in you would instead assert a fact as
a flag. Back in your external application you could check for the
flag and call the clear function externally.

Of course this would mean that your CLIPS deftemplates, defrules etc
and all instances of everything would be deleted from the CLIPS
engine. What are you trying to achieve from clearing at that point in
your app?

Nima

unread,
May 29, 2012, 8:51:52 AM5/29/12
to CLIPSESG
Thanks for your replies.

This simple CLIPS code, after running, asks some questions from user.
I want stop asking if one question reply was Yes!

Nima

unread,
Jun 11, 2012, 4:17:50 PM6/11/12
to CLIPSESG
Hi all,

Please help me how clear my CLIPS program tha is running.

At the end of my program, I have a question that asks from user tha:
"Do You Want To Continue?"

If answer was yes, I want clear screen and run program again

How must I do this work? How clear old information and get new
information?

markc

unread,
Jun 11, 2012, 8:42:48 PM6/11/12
to CLIPSESG
Nima

CLEAR will wipe out the program and require you to reload it. RESET
is probably the better command to be using.

I just tried it using the rule

(defrule bob
(bob man)
=>
(reset)
)

I then asserted

(assert (jill girl))
(assert (bob man))

I then ran the command and checked the facts window. All facts
removed.

You can setup deffacts to initialise your programme so it is primed to
run but you will have to get it to run.

An alternative would be to assert a flag when the user the user
selects continue. Then have a rule that retracts all facts back to
the initial state and kicks off the restart of your questions.

Nima

unread,
Jun 13, 2012, 2:27:56 AM6/13/12
to CLIPSESG
Dear markc,

Thank you very much.
Your help was very useful.
Reply all
Reply to author
Forward
0 new messages