Files
mgmt/lang/interpret_test/TestAstFunc2/complex-example.txtar
James Shubin d1c15bd0b7 lang: funcs: Rename the lookup functions
This will make things more consistent with future use.
2023-10-17 15:21:18 -04:00

26 lines
536 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] {}
#test $foo[1] {}
test list_lookup_optional($foo, 0, "fail") {} # TODO: add syntactic sugar for list_lookup_optional
test list_lookup_optional($foo, 1, "fail") {} # TODO: add syntactic sugar for list_lookup_optional
-- OUTPUT --
Vertex: test[foo]
Vertex: test[foofoo]