N
N
Nastya14882022-03-03 05:01:17
Prolog
Nastya1488, 2022-03-03 05:01:17

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).

He does not like this particular symbol ->
for what reason can this be?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question