lang: funcs: core: iter: Finish map function

This was the goal all along. Proper iteration without for loops.

Yay!

Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
This commit is contained in:
James Shubin
2023-09-25 18:22:22 -04:00
parent 6e1cde815c
commit 2bc23c468e
4 changed files with 319 additions and 49 deletions

View File

@@ -0,0 +1,13 @@
import "iter"
$fn = func($x) { # notable because concrete type is fn(t1) t2, where t1 != t2
len($x)
}
$in1 = ["a", "bb", "ccc", "dddd", "eeeee",]
$out1 = iter.map($in1, $fn)
$t1 = template("out1: {{ . }}", $out1)
test $t1 {}