Fix previous merge issues

This commit is contained in:
Diogo Cordeiro 2018-12-13 17:09:25 +00:00
parent aafef78100
commit 1c498108fc
1 changed files with 10 additions and 8 deletions

View File

@ -170,26 +170,27 @@ 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),
writeln("That's trivial:"),
nlp_compute(P, I)
;
writeln("I didn't understand what you want.")
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(_,_) :-