lang/interpret_test/TestAstFunc2/map-iterator3.txtar
raw| 1 | -- main.mcl -- |
| 2 | import "golang" |
| 3 | import "iter" |
| 4 | |
| 5 | $fn = func($x) { # type changes from str to int |
| 6 | len($x) |
| 7 | } |
| 8 | |
| 9 | $ins = ["a", "bb", "ccc", "dddd", "eeeee",] |
| 10 | |
| 11 | $out = iter.map($ins, $fn) |
| 12 | |
| 13 | $t = golang.template("out: {{ . }}", $out) |
| 14 | |
| 15 | test "${t}" {} |
| 16 | -- OUTPUT -- |
| 17 | Vertex: test[out: [1 2 3 4 5]] |