Files
mgmt/examples/lang/polymorphic-lambda.mcl
2020-02-01 16:48:23 -05:00

20 lines
322 B
Plaintext

import "fmt"
$add = func($x) {
$x + $x
}
$num = 2
$out1 = $add($num) # 4
print fmt.printf("%d + %d is %d", $num, $num, $out1) { # simple math
Meta:autogroup => false,
}
$val = "hello"
$out2 = $add($val) # hellohello
print fmt.printf("%s + %s is %s", $val, $val, $out2) { # simple concat
Meta:autogroup => false,
}