TODO: handle operation order
(a, b Expr)
| 9 | // TODO: handle operation order |
| 10 | |
| 11 | func mul(a, b Expr) Expr { |
| 12 | as := a.String() |
| 13 | bs := b.String() |
| 14 | if as == "1" { |
| 15 | return Expr{Expr: bs} |
| 16 | } |
| 17 | if bs == "1" { |
| 18 | return Expr{Expr: as} |
| 19 | } |
| 20 | return Expr{Expr: as + " * " + bs} |
| 21 | } |
| 22 | |
| 23 | func add(a, b Expr) Expr { |
| 24 | as := a.String() |
no test coverage detected