Added pointless function requested by spec and the partial ability to parse polynomials with normal ops
This commit is contained in:
parent
fffe104684
commit
f9d579c494
18
polymani.pl
18
polymani.pl
@ -85,10 +85,16 @@ polyplay :-
|
|||||||
%% Parsing failed
|
%% Parsing failed
|
||||||
writeln("Could not parse input, so I didn't understand what you want.")
|
writeln("Could not parse input, so I didn't understand what you want.")
|
||||||
),
|
),
|
||||||
%% Go back to the beginning
|
%% Go back to the beginning
|
||||||
polyplay
|
polyplay
|
||||||
),
|
),
|
||||||
!.
|
!.
|
||||||
|
|
||||||
|
text2poly(S, P) :-
|
||||||
|
split_string(S, " ", "\r\t", LS),
|
||||||
|
parse_polynomial(T, LS, []),
|
||||||
|
polynomial_tree_to_polynomial(T, P1),
|
||||||
|
simpoly(P1, P).
|
||||||
|
|
||||||
%% process_input(+Tree) is det
|
%% process_input(+Tree) is det
|
||||||
%
|
%
|
||||||
@ -553,9 +559,9 @@ parse_power(TB) -->
|
|||||||
%
|
%
|
||||||
% Associate an operator with a word
|
% Associate an operator with a word
|
||||||
%
|
%
|
||||||
parse_operation(-) --> [minus].
|
parse_operation(-) --> [minus] | [-].
|
||||||
parse_operation(+) --> [plus].
|
parse_operation(+) --> [plus] | [+].
|
||||||
parse_operation(*) --> [times].
|
parse_operation(*) --> [times] | [*].
|
||||||
|
|
||||||
%% parse_polynomial_operand(-tree) is det
|
%% parse_polynomial_operand(-tree) is det
|
||||||
%
|
%
|
||||||
|
Reference in New Issue
Block a user