lang/interpret_test/TestAstFunc1/efficient-lambda.txtar
raw| 1 | -- main.mcl -- |
| 2 | # this should be a function as a value, iow a lambda |
| 3 | $prefixer = func($x) { |
| 4 | "hello" + $x # i'd only ever expect one "hello" string in the graph |
| 5 | } |
| 6 | |
| 7 | $out1 = $prefixer("a") |
| 8 | $out2 = $prefixer("b") |
| 9 | |
| 10 | test "${out1}" {} # helloa |
| 11 | test "${out2}" {} # hellob |
| 12 | -- OUTPUT -- |
| 13 | Edge: FuncValue -> call # fn |
| 14 | Edge: FuncValue -> call # fn |
| 15 | Vertex: FuncValue |
| 16 | Vertex: call |
| 17 | Vertex: call |
| 18 | Vertex: const |
| 19 | Vertex: const |