lang: core: map: Add functions to extract keys and values

Simple stuff, but now it's done!
This commit is contained in:
James Shubin
2024-10-30 00:58:10 -04:00
parent 71a1efde99
commit 422719c345
3 changed files with 153 additions and 0 deletions

21
examples/lang/map-kv.mcl Normal file
View File

@@ -0,0 +1,21 @@
import "fmt"
import "map"
$some_map = {
"ottawa" => 6,
"toronto" => 7,
"montreal" => 8,
"vancouver" => 9,
}
print "keys" {
msg => fmt.printf("keys: %v", map.keys($some_map)),
Meta:autogroup => false,
}
print "values" {
msg => fmt.printf("values: %v", map.values($some_map)),
Meta:autogroup => false,
}