diff --git a/lang/interpret_test/TestAstFunc2/map-iterator1.txtar b/lang/interpret_test/TestAstFunc2/map-iterator1.txtar index e7b2af3f..26e2a157 100644 --- a/lang/interpret_test/TestAstFunc2/map-iterator1.txtar +++ b/lang/interpret_test/TestAstFunc2/map-iterator1.txtar @@ -5,29 +5,53 @@ func itermap($a, $b) { iter.map($a, $b) } -$fn = func($x) { +func id($x) { $x + $x } +$fn_str = func($x) { + id($x) +} +$fn_int = func($x) { + id($x) +} $in1 = [5, 4, 3, 2, 1,] $in2 = ["a", "b", "c", "d", "e",] +$in3 = [1, 2, 3, 4, 5,] +$in4 = ["e", "d", "c", "b", "a",] -$out1 = iter.map($in1, $fn) -$out2 = iter.map($in2, $fn) -$out3 = itermap($in1, $fn) -$out4 = itermap($in2, $fn) +$out1 = iter.map($in1, $fn_int) +$out2 = iter.map($in2, $fn_str) +$out3 = itermap($in1, $fn_int) +$out4 = itermap($in2, $fn_str) +$out5 = iter.map($in3, func($x) { $x + $x }) +$out6 = iter.map($in4, func($x) { $x + $x }) +$out7 = itermap($in3, func($x) { $x + $x }) +$out8 = itermap($in4, func($x) { $x + $x }) $t1 = template("out1: {{ . }}", $out1) $t2 = template("out2: {{ . }}", $out2) $t3 = template("out3: {{ . }}", $out3) $t4 = template("out4: {{ . }}", $out4) +$t5 = template("out5: {{ . }}", $out5) +$t6 = template("out6: {{ . }}", $out6) +$t7 = template("out7: {{ . }}", $out7) +$t8 = template("out8: {{ . }}", $out8) test $t1 {} test $t2 {} test $t3 {} test $t4 {} +test $t5 {} +test $t6 {} +test $t7 {} +test $t8 {} -- OUTPUT -- Vertex: test[out1: [10 8 6 4 2]] Vertex: test[out2: [aa bb cc dd ee]] Vertex: test[out3: [10 8 6 4 2]] Vertex: test[out4: [aa bb cc dd ee]] +Vertex: test[out5: [2 4 6 8 10]] +Vertex: test[out6: [ee dd cc bb aa]] +Vertex: test[out7: [2 4 6 8 10]] +Vertex: test[out8: [ee dd cc bb aa]]