Answer the question
In order to leave comments, you need to log in
What does an error in Prolog Syntax error: Operator expected code mean?
I am writing an expert system. I know exactly where the error is, but I can't figure out what's wrong.
vine :- catch(Make),
write('your '),
write(Make),
write(' order is ready'),
nl.
undo.
input(Question) :-
write('would you like a '),
write(Question),
write('?'),
read(output),
nl,
((output == yes; output == y)
->
assert(yes(Question));
assert(no(Question)), fail).
:- dynamic yes/1,no/1.
verify(Order) :-
(yes(Order) :-
->
true;
(no(Order)
->
fail;
input(Order))).
undo :- retract(yes(_)),fail.
undo :- retract(no(_)),fail.
undo.
/*Hypothesis*/
grasp(lenova) :- lenova, !.
grasp(apple) :- apple, !.
grasp(empty_basket).
/*knowledge*/
lenova :-
verify(laptop),
verify(lenova),
verify(black_color),
verify(big_screen).
lenova :-
verify(laptop),
verify(lenova),
verify(black_color),
verify(small_screen).
lenova :-
verify(laptop),
verify(lenova),
verify(grey_color),
verify(big_screen).
lenova :-
verify(laptop),
verify(lenova),
verify(grey_color),
verify(small_screen).
apple :-
verify(macbook),
verify(white_color),
verify(large_screen).
apple :-
verify(macbook),
verify(white_color),
verify(mini_screen).
apple :-
verify(macbook),
verify(pink_color),
verify(large_screen).
apple :-
verify(macbook),
verify(pink_color),
verify(mini_screen).
apple :-
verify(macbook),
verify(white_color),
verify(large_screen).
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question