lang: funcs: core: iter: Add map iterator function part2

This adds the Unify method to our map function and also switches the arg
order because I decided it would look nicer. Completely untested.
This commit is contained in:
James Shubin
2021-05-18 03:54:18 -04:00
parent 0be4b86230
commit 75d4d767c6
9 changed files with 346 additions and 25 deletions

View File

@@ -0,0 +1,13 @@
import "iter"
$fn = func($x) { # type changes from str to int
len($x)
}
$in = ["a", "bb", "ccc", "dddd", "eeeee",]
$out = iter.xmap($in, $fn) # XXX: change to map
$t = template("out: {{ . }}", $out)
test $t {}