Skip to content

Commit 95022ec

Browse files
committed
more portable
1 parent 25c8c45 commit 95022ec

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

jscomp/others/belt_internalAVLtree.ml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ let rec findFirstByU n p =
169169
match n with
170170
| None -> None
171171
| Some n ->
172-
let left = n .left |. findFirstByU p in
172+
let left = findFirstByU n.left p in
173173
if left <> None then left
174174
else
175175
let {key = v; value = d} = n in
176176
let pvd = p v d [@bs] in
177177
if pvd then Some(v, d)
178178
else
179-
let right = n.right|. findFirstByU p in
179+
let right = findFirstByU n.right p in
180180
if right <> None then right else None
181181

182182
let findFirstBy n p = findFirstByU n (fun [@bs] a b -> p a b)
@@ -185,9 +185,9 @@ let rec forEachU n f =
185185
match n with
186186
| None -> ()
187187
| Some n ->
188-
n .left |. forEachU f ;
188+
forEachU n.left f ;
189189
f n.key n.value [@bs];
190-
n.right|. forEachU f
190+
forEachU n.right f
191191

192192
let forEach n f = forEachU n (fun [@bs] a b -> f a b)
193193

@@ -196,9 +196,9 @@ let rec mapU n f =
196196
None ->
197197
None
198198
| Some n ->
199-
let newLeft = n .left |. mapU f in
199+
let newLeft = mapU n.left f in
200200
let newD = f n.value [@bs] in
201-
let newRight = n.right|. mapU f in
201+
let newRight = mapU n.right f in
202202
Some { left = newLeft; key = n.key; value = newD; right = newRight; height = n.height}
203203

204204
let map n f = mapU n (fun[@bs] a -> f a)
@@ -209,9 +209,9 @@ let rec mapWithKeyU n f =
209209
None
210210
| Some n ->
211211
let key = n.key in
212-
let newLeft = n .left |. mapWithKeyU f in
212+
let newLeft = mapWithKeyU n.left f in
213213
let newD = f key n.value [@bs] in
214-
let newRight = n.right|. mapWithKeyU f in
214+
let newRight = mapWithKeyU n.right f in
215215
Some { left = newLeft; key; value = newD; right = newRight; height = n.height}
216216

217217
let mapWithKey n f = mapWithKeyU n (fun [@bs] a b -> f a b)
@@ -232,17 +232,17 @@ let rec everyU n p =
232232
None -> true
233233
| Some n ->
234234
p n.key n.value [@bs] &&
235-
n .left |. everyU p &&
236-
n.right|. everyU p
235+
everyU n.left p &&
236+
everyU n.right p
237237
let every n p = everyU n (fun [@bs] a b -> p a b)
238238

239239
let rec someU n p =
240240
match n with
241241
None -> false
242242
| Some n ->
243243
p n.key n.value [@bs] ||
244-
n .left |. someU p ||
245-
n.right|. someU p
244+
someU n.left p ||
245+
someU n.right p
246246
let some n p = someU n (fun[@bs] a b -> p a b)
247247
(* Beware: those two functions assume that the added k is *strictly*
248248
smaller (or bigger) than all the present keys in the tree; it
@@ -304,9 +304,9 @@ let rec keepSharedU n p =
304304
| Some n ->
305305
(* call [p] in the expected left-to-right order *)
306306
let {key = v; value = d} = n in
307-
let newLeft = n .left |. keepSharedU p in
307+
let newLeft = keepSharedU n.left p in
308308
let pvd = p v d [@bs] in
309-
let newRight = n.right|. keepSharedU p in
309+
let newRight = keepSharedU n.right p in
310310
if pvd then join newLeft v d newRight else concat newLeft newRight
311311

312312
let keepShared n p = keepSharedU n (fun [@bs] a b -> p a b)
@@ -317,9 +317,9 @@ let rec keepMapU n p =
317317
| Some n ->
318318
(* call [p] in the expected left-to-right order *)
319319
let {key = v; value = d} = n in
320-
let newLeft = n .left |. keepMapU p in
320+
let newLeft = keepMapU n.left p in
321321
let pvd = p v d [@bs] in
322-
let newRight = n.right|. keepMapU p in
322+
let newRight = keepMapU n.right p in
323323
match pvd with
324324
| None -> concat newLeft newRight
325325
| Some d -> join newLeft v d newRight
@@ -332,9 +332,9 @@ let rec partitionSharedU n p =
332332
| Some n ->
333333
let {key; value } = n in
334334
(* call [p] in the expected left-to-right order *)
335-
let (lt, lf) = n .left |. partitionSharedU p in
335+
let (lt, lf) = partitionSharedU n.left p in
336336
let pvd = p key value [@bs] in
337-
let (rt, rf) = n.right|. partitionSharedU p in
337+
let (rt, rf) = partitionSharedU n.right p in
338338
if pvd
339339
then (join lt key value rt, concat lf rf)
340340
else (concat lt rt, join lf key value rf)
@@ -365,7 +365,7 @@ let rec toListAux n accu =
365365
| None -> accu
366366
| Some n ->
367367
let {left = l; right = r ; key = k; value = v} = n in
368-
l |. toListAux ((k, v) :: ( r |. toListAux accu ))
368+
toListAux l ((k, v) :: (toListAux r accu ))
369369

370370
let toList s =
371371
toListAux s []

0 commit comments

Comments
 (0)