package patience_diff

  1. Overview
  2. Docs

For handling diffs abstractly. A range is a subarray of the two original arrays with a constructor defining its relationship to the two original arrays. A Same range contains a series of elements which can be found in both arrays. A Next range contains elements found only in the second array, while an Prev range contains elements found only in the first array.

A Replace contains two arrays: elements in the first output array are elements found only in the first input array, which have been replaced by elements in the second output array, which are elements found only in the second input array.

type 'a t =
  1. | Same of ('a * 'a) array
  2. | Prev of 'a array
  3. | Next of 'a array
  4. | Replace of 'a array * 'a array
  5. | Unified of 'a array
include Sexplib0.Sexpable.S1 with type 'a t := 'a t
val t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
val all_same : 'a t list -> bool

all_same ranges returns true if all ranges are Same

val prev_only : 'a t list -> 'a t list

prev_only ranges drops all Next ranges and converts all Replace ranges to Prev ranges.

val next_only : 'a t list -> 'a t list

next_only ranges drops all Prev ranges and converts all Replace ranges to Next ranges.

val prev_size : 'a t -> int

Counts number of elements.

val next_size : 'a t -> int
module Stable : sig ... end
OCaml

Innovation. Community. Security.