lang/interpret_test/TestAstFunc2/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 | Vertex: test[hello:world] |
| 16 | Vertex: test[hello:hello:world] |