mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 19:55:31 -05:00
Addresses reviewer comments
This commit is contained in:
parent
7a9a741bb0
commit
745c0cd78e
1 changed files with 13 additions and 24 deletions
|
|
@ -1357,30 +1357,18 @@ let pp ?(start="") ?(stop="") ?(sep=", ") pp_item fmt l =
|
|||
let split l =
|
||||
let rec direct i l = match l with
|
||||
| [] -> ([],[])
|
||||
| [(x1,y1)] -> ([x1], [y1])
|
||||
| [i1; i2] ->
|
||||
let (x1, y1) = i1 in
|
||||
let (x2, y2) = i2 in
|
||||
([x1;x2], [y1;y2])
|
||||
| [i1; i2; i3] ->
|
||||
let (x1, y1) = i1 in
|
||||
let (x2, y2) = i2 in
|
||||
let (x3, y3) = i3 in
|
||||
([x1;x2;x3], [y1;y2;y3])
|
||||
| [i1; i2; i3; i4] ->
|
||||
let (x1, y1) = i1 in
|
||||
let (x2, y2) = i2 in
|
||||
let (x3, y3) = i3 in
|
||||
let (x4, y4) = i4 in
|
||||
([x1;x2;x3;x4], [y1;y2;y3;y4])
|
||||
| [ x1,y1 ] -> [x1], [y1]
|
||||
| [ x1, y1; x2, y2 ] -> [x1;x2], [y1;y2]
|
||||
| [ x1, y1; x2, y2 ; x3, y3 ] -> [x1;x2;x3], [y1;y2;y3]
|
||||
| [ x1, y1; x2, y2; x3, y3; x4, y4] -> [x1;x2;x3;x4], [y1;y2;y3;y4]
|
||||
| _ when i=0 -> split_slow ([], []) l
|
||||
| i1 :: i2 :: i3 :: i4 :: i5 :: l' ->
|
||||
let (x1, y1) = i1 in
|
||||
let (x2, y2) = i2 in
|
||||
let (x3, y3) = i3 in
|
||||
let (x4, y4) = i4 in
|
||||
let (x5, y5) = i5 in
|
||||
let (rx, ry) = direct (i-1) l' in
|
||||
| (x1, y1) ::
|
||||
(x2, y2) ::
|
||||
(x3, y3) ::
|
||||
(x4, y4) ::
|
||||
(x5, y5) :: l' ->
|
||||
let rx, ry = direct (i-1) l'
|
||||
in
|
||||
(x1 :: x2 :: x3 :: x4 :: x5 :: rx
|
||||
,y1 :: y2 :: y3 :: y4 :: y5 :: ry)
|
||||
and split_slow acc l = match l with
|
||||
|
|
@ -1388,7 +1376,8 @@ let split l =
|
|||
| (x1, y1) :: l' ->
|
||||
let (x_acc, y_acc) = acc in
|
||||
let x_acc = x1 :: x_acc in
|
||||
let y_acc = y1 :: y_acc in
|
||||
let y_acc = y1 :: y_acc
|
||||
in
|
||||
split_slow (x_acc, y_acc) l'
|
||||
in
|
||||
direct direct_depth_default_ l
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue