package merlin-lib

  1. Overview
  2. Docs
Merlin's libraries

Install

dune-project
 Dependency

Authors

Maintainers

Sources

merlin-5.8.1-505.tbz
sha256=b8fb32bc0fc092af2fd6bdc831cb966057f2e3fd7b99a172b705e96ba8082583
sha512=01ca96f8167d062ba24036e43f650ff958fb157d44867bd52eb7999b7d19bf9fc97cdcd46c04b6979f0e1149d5041047723eed5913b03c4404d7acb116183bee

doc/merlin-lib.ocaml_utils/Ocaml_utils/Misc/Stdlib/List/index.html

Module Stdlib.ListSource

Extensions to the List module

Sourcetype 'a t = 'a list
Sourceval compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

The lexicographic order supported by the provided order. There is no constraint on the relative lengths of the lists.

Sourceval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

Returns true if and only if the given lists have the same length and content with respect to the given equality function.

Sourceval some_if_all_elements_are_some : 'a option t -> 'a t option

If all elements of the given list are Some _ then Some xs is returned with the xs being the contents of those Somes, with order preserved. Otherwise return None.

Sourceval map2_prefix : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t * 'b t

let r1, r2 = map2_prefix f l1 l2 If l1 is of length n and l2 = h2 @ t2 with h2 of length n, r1 is List.map2 f l1 h1 and r2 is t2.

Sourceval iteri2 : (int -> 'a -> 'b -> unit) -> 'a list -> 'b list -> unit

Same as List.iter2, but the function is applied to the index of the element as first argument (counting from 0)

Sourceval split_at : int -> 'a t -> 'a t * 'a t

split_at n l returns the pair before, after where before is the n first elements of l and after the remaining ones. If l has less than n elements, raises Invalid_argument.

Sourceval chunks_of : int -> 'a t -> 'a t t

chunks_of n t returns a list of nonempty lists whose concatenation is equal to the original list. Every list has n elements, except for possibly the last list, which may have fewer. chunks_of raises if n <= 0.

Sourceval is_prefix : equal:('a -> 'a -> bool) -> 'a list -> of_:'a list -> bool

Returns true if and only if the given list, with respect to the given equality function on list members, is a prefix of the list of_.

Sourcetype 'a longest_common_prefix_result = private {
  1. longest_common_prefix : 'a list;
  2. first_without_longest_common_prefix : 'a list;
  3. second_without_longest_common_prefix : 'a list;
}
Sourceval find_and_chop_longest_common_prefix : equal:('a -> 'a -> bool) -> first:'a list -> second:'a list -> 'a longest_common_prefix_result

Returns the longest list that, with respect to the provided equality function, is a prefix of both of the given lists. The input lists, each with such longest common prefix removed, are also returned.