As its name implies, the OCaml Rope library implements the
immutable
rope
datastructure [1] (with some small variations).
All meaningful String
module functions
are implemented; regular expressions are planned (help
appreciated).
Here is an example use of Rope
in the
interactive toploop (notice the special printer to
conveniently display ropes):
# #load "rope.cma";;
# #install_printer Rope.Rope_toploop.printer;;
# let ( ^ ) = Rope.concat2;;
val ( ^ ) : Rope.t -> Rope.t -> Rope.t = <fun>
# let r = Rope.of_string "Hello" ^ Rope.of_string " " ^ Rope.of_string "world!";;
val r : Rope.t = "Hello world!"
# Rope.length r;;
- : int = 12
For a complete description of the functions, see the
interface Rope.mli
.
If you have questions, suggestions, bugs,... you can
contact me by email.
The code is released under the GNU Lesser General Public License (LGPL) with the same special exception as for the OCaml standard library (see the file LICENSE for more details).
[1] Hans Boehm, Russ Atkinson, Michael Plass, "Ropes: an alternative to strings", Software Practice and Experience 25, vol. 12 (1995), pp. 1315-1330.