Fix previous merge issues

This commit is contained in:
Diogo Cordeiro 2018-12-13 17:09:25 +00:00
parent aafef78100
commit 1c498108fc

View File

@ -170,11 +170,12 @@ instruction(Left_expr, Right_expr) --> command, expression(Left_expr), separator
polyplay :-
write("> "),
read_line_to_codes(user_input, R),
read_string(user_input, "\n", "\r\t ", _, Stdin),
split_string(Stdin, " ", "", R),
(
writeln(R),
R = "bye",
write("See ya")
R == ["bye"],
write("See ya"),
!
;
(
nlp_understand(R, P, I),
@ -184,12 +185,12 @@ polyplay :-
writeln("I didn't understand what you want.")
),
polyplay
).
),
!.
nlp_understand(R, P, I) :-
split_string(R, "\n", "\r\t ", RL),
(
RL = "simplify x squared",
R == ["simplify", "x", "squared"],
P = simplify,
I = x^2
;
@ -197,6 +198,7 @@ nlp_understand(R, P, I) :-
).
nlp_compute(simplify, P) :-
!,
simplify_polynomial(P, O),
writeln(O).
nlp_compute(_,_) :-