package core_kernel

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module RopeSource

A rope is a standard data structure that represents a single string as a tree of strings, allowing concatenation to do no work up front. See the README.md file for details and motivating examples.

Sourcetype t
Sourceval equal : t -> t -> bool
Sourceval quickcheck_generator : t Base_quickcheck.Generator.t
Sourceval quickcheck_observer : t Base_quickcheck.Observer.t
Sourceval quickcheck_shrinker : t Base_quickcheck.Shrinker.t
include Ppx_sexp_conv_lib.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0__.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0__.Sexp.t
Sourceval of_string : string -> t

Takes O(1) time. The string isn't copied, so don't mutate it.

Sourceval empty : t
Sourceval is_empty : t -> bool
Sourceval length : t -> int
Sourceval to_string : t -> string

Allocates a fresh string, so takes time proportional to the total size of the result.

Sourceval to_char_sequence : t -> char Core_kernel.Sequence.t

to_char_sequence can often produce characters incrementally, but in the worst case it takes time and memory proportional to the total length of the string to produce even a single character. (In such cases, it should still only take O(length) time to produce the rest of the string.)

Sourceval (^) : t -> t -> t

These take time proportional to the number of t's passed.

Sourceval concat : ?sep:t -> t list -> t
Sourceval concat_array : ?sep:t -> t array -> t
Sourceval add_to_buffer : t -> Core_kernel.Buffer.t -> unit

Appends the contents of the Rope at the end of a destination buffer.

Sourceval is_prefix : t -> prefix:t -> bool

is_prefix a ~prefix:b is a more efficient version of String.is_prefix (Rope.to_string a) ~prefix:(Rope.to_string b). However, the worst-case time complexity is still O(length t) instead of O(min(length t, length prefix)) as one could expect.

Sourcemodule For_testing : sig ... end
OCaml

Innovation. Community. Security.