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