| 1 |
-- main.mcl -- |
| 2 |
import "os" |
| 3 |
$apply1 = func($f, $x) { |
| 4 |
$f($x) |
| 5 |
} |
| 6 |
$apply2 = func($f, $x) { |
| 7 |
$f($f($x)) |
| 8 |
} |
| 9 |
$apply = if (os.system("echo 0; echo 1") == "0") {$apply1} else {$apply2} |
| 10 |
$id = func($y) { $y } |
| 11 |
|
| 12 |
# since $apply changes over time, this call needs a dynamic sub-graph. In |
| 13 |
# theory, the $f calls above do not need a sub-graph, but does our optimization |
| 14 |
# support this corner case yet? |
| 15 |
$name = $apply($id, "foo") |
| 16 |
test "${name}" {} |
| 17 |
-- OUTPUT -- |
| 18 |
Vertex: test[foo] |