This removes the exclusive from the res names and edge names. We now require that the names should be lists of strings, however they can still be single strings if that can be determined statically. Programmers should explicitly wrap their variables in a string by interpolation to force this, or in square brackets to force a list. The former is generally preferable because it generates a small function graph since it doesn't need to build a list.
21 lines
410 B
Plaintext
21 lines
410 B
Plaintext
-- main.mcl --
|
|
import "fmt"
|
|
|
|
# this should be a regular polymorphic function
|
|
func add($x) {
|
|
$x + $x
|
|
}
|
|
|
|
$num = 2
|
|
$out1 = add($num) # 4
|
|
|
|
test [fmt.printf("%d + %d is %d", $num, $num, $out1),] {} # simple math
|
|
|
|
$val = "hello"
|
|
$out2 = add($val) # hellohello
|
|
|
|
test [fmt.printf("%s + %s is %s", $val, $val, $out2),] {} # simple concat
|
|
-- OUTPUT --
|
|
Vertex: test[2 + 2 is 4]
|
|
Vertex: test[hello + hello is hellohello]
|