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 :- polyplay :-
write("> "), write("> "),
read_line_to_codes(user_input, R), read_string(user_input, "\n", "\r\t ", _, Stdin),
split_string(Stdin, " ", "", R),
( (
writeln(R), R == ["bye"],
R = "bye", write("See ya"),
write("See ya") !
; ;
( (
nlp_understand(R, P, I), nlp_understand(R, P, I),
writeln("That's trivial:"), writeln("That's trivial:"),
nlp_compute(P, I) nlp_compute(P, I)
; ;
writeln("I didn't understand what you want.") writeln("I didn't understand what you want.")
), ),
polyplay polyplay
). ),
!.
nlp_understand(R, P, I) :- nlp_understand(R, P, I) :-
split_string(R, "\n", "\r\t ", RL),
( (
RL = "simplify x squared", R == ["simplify", "x", "squared"],
P = simplify, P = simplify,
I = x^2 I = x^2
; ;
@ -197,6 +198,7 @@ nlp_understand(R, P, I) :-
). ).
nlp_compute(simplify, P) :- nlp_compute(simplify, P) :-
!,
simplify_polynomial(P, O), simplify_polynomial(P, O),
writeln(O). writeln(O).
nlp_compute(_,_) :- nlp_compute(_,_) :-