24 lines
356 B
Plaintext
24 lines
356 B
Plaintext
-- main.mcl --
|
|
import "fmt"
|
|
import "iter"
|
|
|
|
# function expression
|
|
$id1 = func($x str) { # definition site
|
|
$x
|
|
}
|
|
$id2 = func($x str) {
|
|
$x + $x
|
|
}
|
|
|
|
$generate = func($idn) {
|
|
$idn("foo") # 1 call site, 2 calls
|
|
}
|
|
|
|
$foo = iter.map([$id1, $id2,], $generate)
|
|
|
|
test $foo[0] || "fail" {}
|
|
test $foo[1] || "fail" {}
|
|
-- OUTPUT --
|
|
Vertex: test[foo]
|
|
Vertex: test[foofoo]
|