lang: core: list: Add a concat function
It works with arbitrary numbers of arguments too!
This commit is contained in:
17
examples/lang/concat.mcl
Normal file
17
examples/lang/concat.mcl
Normal file
@@ -0,0 +1,17 @@
|
||||
import "golang/strings"
|
||||
import "list"
|
||||
|
||||
$l1 = ["a", "b", "c", "d", "e", "f", "g",]
|
||||
$l2 = ["h", "i", "j", "k", "l", "m", "n", "o", "p",]
|
||||
$l3 = ["q", "r", "s",]
|
||||
$l4 = ["t", "u", "v",]
|
||||
$l5 = ["w", "x",]
|
||||
$l6 = ["y", "zed",]
|
||||
|
||||
$l = list.concat($l1, $l2, $l3, $l4, $l5, $l6)
|
||||
|
||||
$joined = strings.join($l, "-")
|
||||
|
||||
print "alphabet" {
|
||||
msg => "${joined}",
|
||||
}
|
||||
Reference in New Issue
Block a user