Open fjames86 opened 11 years ago
could rewrite the parser to be more general/abstract.
instead of parsing the input string directly to a polynomial object, parse it to a parse-tree. this can then be converted to the structure itself. e.g.
(parse "x^2 + 2y") -> (:poly (x y) (1 (2 0)) (2 (0 1))) (parse "xy^(1 - 2*6)") -> (:poly (x y) (1 (1 -11))) (parse "cos(x + y)") -> (:apply cos (:poly (x y) (1 (1 0)) (1 (0 1))))
this then allows representing arbitrary expressions, e.g. function application etc.
could rewrite the parser to be more general/abstract.
instead of parsing the input string directly to a polynomial object, parse it to a parse-tree. this can then be converted to the structure itself. e.g.
(parse "x^2 + 2y") -> (:poly (x y) (1 (2 0)) (2 (0 1))) (parse "xy^(1 - 2*6)") -> (:poly (x y) (1 (1 -11))) (parse "cos(x + y)") -> (:apply cos (:poly (x y) (1 (1 0)) (1 (0 1))))
this then allows representing arbitrary expressions, e.g. function application etc.