mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
small refactor
This commit is contained in:
parent
81408b8e1b
commit
04440deb39
1 changed files with 1 additions and 6 deletions
|
|
@ -32,8 +32,7 @@ module A = struct
|
||||||
if n = 0 then invalid_arg "Pvec.pop";
|
if n = 0 then invalid_arg "Pvec.pop";
|
||||||
Array.sub self 0 (n - 1)
|
Array.sub self 0 (n - 1)
|
||||||
|
|
||||||
(* TODO: remove *)
|
let set (self : _ t) i x : _ t =
|
||||||
let set ~mut (self : _ t) i x : _ t =
|
|
||||||
if i < 0 || i > length self || i >= branching_factor then
|
if i < 0 || i > length self || i >= branching_factor then
|
||||||
invalid_arg "Pvec.set";
|
invalid_arg "Pvec.set";
|
||||||
if i = length self then (
|
if i = length self then (
|
||||||
|
|
@ -41,10 +40,6 @@ module A = struct
|
||||||
let arr = Array.make (i + 1) x in
|
let arr = Array.make (i + 1) x in
|
||||||
Array.blit self 0 arr 0 i;
|
Array.blit self 0 arr 0 i;
|
||||||
arr
|
arr
|
||||||
) else if mut then (
|
|
||||||
(* replace element at [i] in place *)
|
|
||||||
self.(i) <- x;
|
|
||||||
self
|
|
||||||
) else (
|
) else (
|
||||||
(* replace element at [i] in copy *)
|
(* replace element at [i] in copy *)
|
||||||
let arr = Array.copy self in
|
let arr = Array.copy self in
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue