lang: core: list: Add a concat function

It works with arbitrary numbers of arguments too!
This commit is contained in:
James Shubin
2024-10-17 18:35:29 -04:00
parent 3d11b2caaf
commit 10f82c6566
2 changed files with 241 additions and 0 deletions

17
examples/lang/concat.mcl Normal file
View 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}",
}