NOTE: we can't use !+..!- comments to excerpt these tests into the book because it defeats the Example mechanism, which requires the // Output comment to be at the end of the function.
()
| 20 | // of the function. |
| 21 | |
| 22 | func Example_expr() { |
| 23 | e, _ := eval.Parse("sqrt(A / pi)") |
| 24 | Display("e", e) |
| 25 | // Output: |
| 26 | // Display e (eval.call): |
| 27 | // e.fn = "sqrt" |
| 28 | // e.args[0].type = eval.binary |
| 29 | // e.args[0].value.op = 47 |
| 30 | // e.args[0].value.x.type = eval.Var |
| 31 | // e.args[0].value.x.value = "A" |
| 32 | // e.args[0].value.y.type = eval.Var |
| 33 | // e.args[0].value.y.value = "pi" |
| 34 | } |
| 35 | |
| 36 | func Example_slice() { |
| 37 | Display("slice", []*int{new(int), nil}) |