This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
compilation/flap/tests/04-Hobix_to_Fopix/09-curryNM.hobix
2023-12-11 11:49:02 +01:00

29 lines
1.5 KiB
Text

val curry_1_2 = \(f) => \(x) => \(y) => f (x, y)
val curry_1_3 = \(f) => \(x) => \(y1, y2) => f (x, y1, y2)
val curry_1_4 = \(f) => \(x) => \(y1, y2, y3) => f (x, y1, y2, y3)
val curry_1_5 = \(f) => \(x) => \(y1, y2, y3, y4) => f (x, y1, y2, y3, y4)
val curry_1_6 = \(f) => \(x) => \(y1, y2, y3, y4, y5) => f (x, y1, y2, y3, y4, y5)
val f2 = \(x1, x2) => x1 + x2
val f3 = \(x1, x2, x3) => x1 + x2 + x3
val f4 = \(x1, x2, x3, x4) => x1 + x2 + x3 + x4
val f5 = \(x1, x2, x3, x4, x5) => x1 + x2 + x3 + x4 + x5
val f6 = \(x1, x2, x3, x4, x5, x6) => x1 + x2 + x3 + x4 + x5 + x6
val test1_2 = print_int (curry_1_2 (f2) (1) (2))
val test1_3 = print_int (curry_1_3 (f3) (1) (2, 3))
val test1_4 = print_int (curry_1_4 (f4) (1) (2, 3, 4))
val test1_5 = print_int (curry_1_5 (f5) (1) (2, 3, 4, 5))
val test1_6 = print_int (curry_1_6 (f6) (1) (2, 3, 4, 5, 6))
val curry_2_2 = \(f) => \(o, x) => \(y) => f (x, y)
val curry_2_3 = \(f) => \(o, x) => \(y1, y2) => f (x, y1, y2)
val curry_2_4 = \(f) => \(o, x) => \(y1, y2, y3) => f (x, y1, y2, y3)
val curry_2_5 = \(f) => \(o, x) => \(y1, y2, y3, y4) => f (x, y1, y2, y3, y4)
val curry_2_6 = \(f) => \(o, x) => \(y1, y2, y3, y4, y5) => f (x, y1, y2, y3, y4, y5)
val test2_2 = print_int (curry_2_2 (f2) (0, 1) (2))
val test2_3 = print_int (curry_2_3 (f3) (0, 1) (2, 3))
val test2_4 = print_int (curry_2_4 (f4) (0, 1) (2, 3, 4))
val test2_5 = print_int (curry_2_5 (f5) (0, 1) (2, 3, 4, 5))
val test2_6 = print_int (curry_2_6 (f6) (0, 1) (2, 3, 4, 5, 6))