polymorphism_test.aes
1 2 contract Identity = 3 4 function zip_with(f, xs, ys) = 5 switch((xs, ys)) 6 (x :: xs, y :: ys) => f(x, y) :: zip_with(f, xs, ys) 7 _ => [] 8 9 // Check that we can use zip_with at different types 10 11 entrypoint foo() = 12 zip_with((x, y) => x + y, [1, 2, 3], [4, 5, 6, 7]) 13 14 entrypoint bar() = 15 zip_with((x, y) => if(x) y else 0, [true, false, true, false], [1, 2, 3]) 16