Clips 6.3 Expected the beginning of a construct. Not Working

43 Views Asked by At

Can anyone help me too?

I have, Lab3 - load1:

(deftemplate persoana(slot nume)(slot varsta)(slot culoare_par)(slot culoare_ochi))

And Lab3 - load 2:

(clear)

(load Lab3 - load1.clp)

(assert(persoana(nume "John")(varsta 25)(culoare_par "brunet")(culoare_ochi "albastri")))

(assert(persoana(nume "Alice")(varsta 30)(culoare_par "blond")(culoare_ochi "verzi")))

(facts)

(retract 1)

(modify 2(varsta 32))

(printout t "Suma a doua numere: " (+ 5 3) crlf)

But, when I loaded the load1 file: CLIPS> (load "C:/Users/Cristian/Desktop/Facultate/IA CLIPS 6.3 Laboratoare/Lab 3 CLIPS/Lab3 - load1.clp") Defining deftemplate: persoana TRUE

And when I loaded next file, load2: CLIPS> (load "C:/Users/Cristian/Desktop/Facultate/IA CLIPS 6.3 Laboratoare/Lab 3 CLIPS/Lab3 - load2.clp")

[CSTRCPSR1] Expected the beginning of a construct. FALSE

Why? What is wrong with this app?..

1

There are 1 best solutions below

0
Gary Riley On

You need to use the load command for loading constructs (such as deftemplate in load1.clp) and batch command for executing commands (such as clear, load, and assert). If you change the arguments to the load command in load2.clp to make it a valid path (e.g. you can't have spaces in a path unless it's delimited by double quotes), then you can run your lab by using the batch command on load2.clp.

         CLIPS (6.4.1 4/8/23)
CLIPS> (batch "Lab3 - load2.clp")
TRUE
CLIPS> (clear)
CLIPS> 
(load "Lab3 - load1.clp")
%
TRUE
CLIPS> 
(assert(persoana(nume "John")(varsta 25)(culoare_par "brunet")(culoare_ochi "albastri")))
<Fact-1>
CLIPS> 
(assert(persoana(nume "Alice")(varsta 30)(culoare_par "blond")(culoare_ochi "verzi")))
<Fact-2>
CLIPS> 
(facts)
f-1     (persoana (nume "John") (varsta 25) (culoare_par "brunet") (culoare_ochi "albastri"))
f-2     (persoana (nume "Alice") (varsta 30) (culoare_par "blond") (culoare_ochi "verzi"))
For a total of 2 facts.
CLIPS> 
(retract 1)
CLIPS> 
(modify 2(varsta 32))
<Fact-2>
CLIPS> 
(printout t "Suma a doua numere: " (+ 5 3) crlf)
Suma a doua numere: 8
CLIPS> 

There are multiple prior answers to this same question on stack overflow and other internet forums that you can find using the search query "expected the beginning of a construct" in a search engine.