lang/interpret_test/TestAstFunc1/simple-lambda2.txtar
raw| 1 | -- main.mcl -- |
| 2 | import "fmt" |
| 3 | |
| 4 | # this should be a function as a value, iow a lambda |
| 5 | $answer = func() { |
| 6 | "the answer is 42" |
| 7 | } |
| 8 | |
| 9 | $out1 = $answer() |
| 10 | $out2 = $answer() |
| 11 | |
| 12 | test [$out1 + $out2,] {} |
| 13 | -- OUTPUT -- |
| 14 | Edge: FuncValue -> call # fn |
| 15 | Edge: FuncValue -> call # fn |
| 16 | Edge: FuncValue -> call # fn |
| 17 | Edge: call -> composite # 0 |
| 18 | Vertex: FuncValue |
| 19 | Vertex: FuncValue |
| 20 | Vertex: call |
| 21 | Vertex: call |
| 22 | Vertex: call |
| 23 | Vertex: composite |
| 24 | Vertex: const |