]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
rename Rope.iteri to Rope.each_byte
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 19 Dec 2017 18:23:10 +0000 (13:23 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 19 Dec 2017 18:23:10 +0000 (13:23 -0500)
lib/buf.ml
lib/rope.ml
lib/rope.mli

index 9de0a6a3b995dae7e770d917bf267da2ffa1e828..dfeba1c65d874dc3285777cee12c443d62b6f9c0 100644 (file)
@@ -73,7 +73,7 @@ let make_lexer buf =
     scanfn = buf.lexfn;
     lexbuf = Lexing.from_function (fun bytebuf n ->
       let count = ref 0 in
-      Rope.iteri (fun i c ->
+      Rope.each_byte (fun i c ->
         Bytes.set bytebuf !count (Char.chr c);
         incr count;
         (!count >= n)) buf.rope !pos;
index 4b192c37e432311c5014aebebfd4bb9fab86cac2..197192ad553916cd387466bb82133c80205979af 100644 (file)
@@ -106,14 +106,13 @@ let rec each_rune fn rope pos =
 
 (******************************************************************************)
 
-(* inefficient form of iteri *)
-let rec iteri fn rope pos =
+let rec each_byte fn rope pos =
   if pos < (length rope) && (fn pos (getb rope pos)) then
-    iteri fn rope (pos + 1)
+    each_byte fn rope (pos + 1)
 
 let gets rope i j =
   let buf = Bytes.create (j - i) in
-  iteri
+  each_byte
     (fun n c ->
       Bytes.set buf (n - i) (Char.chr c);
       (n <= j))
index 41598b57075ace5603e40a561bf0e6b2a954b5b7..ed40cb59a2d25b226c8bf98d6aa0273989c44924 100644 (file)
@@ -21,7 +21,7 @@ val flatten : rope -> rope
 val split : rope -> int -> (rope * rope)
 val del : rope -> int -> int -> rope
 
-val iteri : (int -> rune -> bool) -> rope -> int -> unit
+val each_byte : (int -> rune -> bool) -> rope -> int -> unit
 val each_rune : (int -> rune -> bool) -> rope -> int -> unit
 
 val getb : rope -> int -> int