Files
mgmt/lang/interpret_test/TestAstFunc2/map-iterator1/main.mcl
James Shubin 75d4d767c6 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.
2022-08-04 14:24:05 -04:00

28 lines
595 B
Plaintext

import "iter"
func iterxmap($a, $b) { # XXX: change to map
iter.xmap($a, $b) # XXX: change to map
}
$fn = func($x) {
$x + $x
}
$in1 = [5, 4, 3, 2, 1,]
$in2 = ["a", "b", "c", "d", "e",]
$out1 = iter.xmap($in1, $fn) # XXX: change to map
$out2 = iter.xmap($in2, $fn) # XXX: change to map
$out3 = iterxmap($in1, $fn) # XXX: change to map
$out4 = iterxmap($in2, $fn) # XXX: change to map
$t1 = template("out1: {{ . }}", $out1)
$t2 = template("out2: {{ . }}", $out2)
$t3 = template("out3: {{ . }}", $out3)
$t4 = template("out4: {{ . }}", $out4)
test $t1 {}
test $t2 {}
test $t3 {}
test $t4 {}