Skip to content

Commit d9a7035

Browse files
committed
some of earger_curry_test
1 parent 14a0b35 commit d9a7035

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

jscomp/test/earger_curry_test.res

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
let f = g => (. x) => g(x)
1+
let f = g => x => g(x)
22

33
let map = (f, a) => {
44
let l = Array.length(a)
55
if l == 0 {
66
[]
77
} else {
8-
let r = Array.make(l, f(. Array.unsafe_get(a, 0)))
8+
let r = Array.make(l, f(Array.unsafe_get(a, 0)))
99
for i in 1 to l - 1 {
10-
Array.unsafe_set(r, i, f(. Array.unsafe_get(a, i)))
10+
Array.unsafe_set(r, i, f(Array.unsafe_get(a, i)))
1111
}
1212
r
1313
}
1414
}
1515

16-
let map = (type u v, f: u => v, a: array<u>): array<v> => map((. x) => f(x), a)
16+
let map = (type u v, f: u => v, a: array<u>): array<v> => map(x => f(x), a)
1717

1818
let init = (l, f) =>
1919
if l == 0 {
@@ -24,24 +24,24 @@ let init = (l, f) =>
2424
/* See #6575. We could also check for maximum array size, but this depends
2525
on whether we create a float array or a regular one... */
2626

27-
let res = Array.make(l, f(. 0))
27+
let res = Array.make(l, f(0))
2828
for i in 1 to pred(l) {
29-
Array.unsafe_set(res, i, f(. i))
29+
Array.unsafe_set(res, i, f(i))
3030
}
3131
res
3232
}
3333

34-
let init = (l, f) => init(l, (. x) => f(x))
34+
let init = (l, f) => init(l, x => f(x))
3535

3636
let fold_left = (f, x, a) => {
3737
let r = ref(x)
3838
for i in 0 to Array.length(a) - 1 {
39-
r := f(. r.contents, Array.unsafe_get(a, i))
39+
r := f(r.contents, Array.unsafe_get(a, i))
4040
}
4141
r.contents
4242
}
4343

44-
let fold_left = (f, x, a) => fold_left((. x, y) => f(x, y), x, a)
44+
let fold_left = (f, x, a) => fold_left((x, y) => f(x, y), x, a)
4545

4646
@val external timeStart: string => unit = "console.time"
4747

@@ -97,8 +97,8 @@ let add5 = (a0, a1, a2, a3, a4) => {
9797
a0 + a1 + a2 + a3 + a4
9898
}
9999

100-
let f = x =>
101-
/* let u = */ add5(
100+
let f = x => /* let u = */ (a, b) =>
101+
add5(
102102
x,
103103
{
104104
incr(v)
@@ -108,26 +108,31 @@ let f = x =>
108108
incr(v)
109109
2
110110
},
111+
a,
112+
b,
111113
) /* in */
112114
/* all_v := !v :: !all_v ;
113115
u */
114116

115117
let g = x => {
116-
let u = add5(
117-
x,
118-
{
119-
incr(v)
120-
1
121-
},
122-
{
123-
incr(v)
124-
2
125-
},
126-
)
118+
let u = (a, b) =>
119+
add5(
120+
x,
121+
{
122+
incr(v)
123+
1
124+
},
125+
{
126+
incr(v)
127+
2
128+
},
129+
a,
130+
b,
131+
)
127132
all_v := list{v.contents, ...all_v.contents}
128133
u
129134
}
130-
let a = f(0, 3, 4)
135+
let a = f(0)(3, 4)
131136

132137
let b = f(0, 3, 5)
133138

0 commit comments

Comments
 (0)