lang/interpret_test/TestAstFunc2/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 | Vertex: test[helloa] |
| 14 | Vertex: test[hellob] |