|
11 | 11 |
|
12 | 12 | shower(ex) = sprint((io, e) -> show(io, MIME"text/plain"(), e), ex) |
13 | 13 |
|
14 | | - f_plus_g = StructuredExpression((; f, g), nt -> nt.f + nt.g) |
15 | | - f_div_g = StructuredExpression((; f, g), nt -> nt.f / nt.g) |
16 | | - cos_f = StructuredExpression((; f), nt -> cos(nt.f)) |
17 | | - exp_g = StructuredExpression((; g), nt -> exp(nt.g)) |
| 14 | + f_plus_g = StructuredExpression((; f, g); structure=nt -> nt.f + nt.g) |
| 15 | + f_div_g = StructuredExpression((; f, g); structure=nt -> nt.f / nt.g) |
| 16 | + cos_f = StructuredExpression((; f); structure=nt -> cos(nt.f)) |
| 17 | + exp_g = StructuredExpression((; g); structure=nt -> exp(nt.g)) |
18 | 18 |
|
19 | 19 | @test shower(f_plus_g) == "((x * x) - cos((2.5 * y) + -0.5)) + exp(-(y * y))" |
20 | 20 | @test shower(f_div_g) == "((x * x) - cos((2.5 * y) + -0.5)) / exp(-(y * y))" |
|
43 | 43 | f = parse_expression(:(x * x - cos(2.5f0 * y + -0.5f0)); kws...) |
44 | 44 | g = parse_expression(:(exp(-(y * y))); kws...) |
45 | 45 |
|
46 | | - ex = StructuredExpression((; f, g), nt -> nt.f + nt.g) |
| 46 | + ex = StructuredExpression((; f, g); structure=nt -> nt.f + nt.g) |
47 | 47 |
|
48 | 48 | @test test(ExpressionInterface, StructuredExpression, [ex]) |
49 | 49 | end |
|
64 | 64 | g = parse_expression(:(exp(-(y * y))); kws...) |
65 | 65 |
|
66 | 66 | c = [1] |
67 | | - ex = StructuredExpression((; f, g), my_factory; a=c) |
| 67 | + ex = StructuredExpression((; f, g); structure=my_factory, a=c) |
68 | 68 |
|
69 | 69 | @test ex.metadata.extra.a[] == 1 |
70 | 70 | @test ex.metadata.extra.a === c |
|
114 | 114 | This is a composite `AbstractExpression` object that composes multiple |
115 | 115 | expressions during evaluation. |
116 | 116 | =# |
117 | | - ex = StructuredExpression((; f, g), nt -> nt.f + nt.g; operators, variable_names) |
| 117 | + ex = StructuredExpression((; f, g); structure=nt -> nt.f + nt.g, operators, variable_names) |
118 | 118 | ex |
119 | 119 | @test typeof(ex) <: AbstractExpression{Float64,<:Node{Float64}} #src |
120 | 120 | #= |
|
0 commit comments