Add new macro M_CROSS_MAP

enabling to map a function to each pair
of arguments given two arglists.
This commit is contained in:
Patrick Pelissier committed 2022-09-25 00:30:23 +02:00
1 parent 3641829198
commit 5674cdbfc5
2 files changed
+123

No files matched your search

+6
View File
@@ -270,6 +270,12 @@ static void test_map(void)
assert (M_MAP3 (f3, 2, 2) 0 == 4);
assert (M_MAP3 (f3, 3, 2, 4) 0 == 30);
assert (M_MAP3 (f3, 4, 2, 4, 6) 0 == 8+32+12*6);
assert (M_CROSS_MAP(f2, (1), (2)) 0 == 1*2);
assert (M_CROSS_MAP(f2, (1), (2, 3)) 0 == 1*2+1*3);
assert (M_CROSS_MAP(f2, (1, 3), (2)) 0 == 1*2+3*2);
assert (M_CROSS_MAP(f2, (1, 3), (2,4)) 0 == 1*2 + 1*4 + 3*2 + 3*4);
assert (M_CROSS_MAP(f2, (1, 3, 5), (2,4)) 0 == 1*2 + 1*4 + 3*2 + 3*4 + 5*2 + 5*4);
}
static void test_let(void)