You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.8 KiB
56 lines
1.8 KiB
5 years ago
|
(*
|
||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*)
|
||
|
|
||
5 years ago
|
open NS0
|
||
5 years ago
|
include module type of Core.List
|
||
5 years ago
|
|
||
|
val pp :
|
||
|
?pre:(unit, unit) fmt
|
||
|
-> ?suf:(unit, unit) fmt
|
||
|
-> (unit, unit) fmt
|
||
|
-> 'a pp
|
||
|
-> 'a list pp
|
||
|
(** Pretty-print a list. *)
|
||
|
|
||
|
val pp_diff :
|
||
|
compare:('a -> 'a -> int)
|
||
|
-> (unit, unit) fmt
|
||
|
-> 'a pp
|
||
|
-> ('a list * 'a list) pp
|
||
|
|
||
5 years ago
|
val findi : 'a -> 'a t -> int option
|
||
|
(** [findi x xs] is [Some i] when [nth xs i == x], otherwise [None]. *)
|
||
|
|
||
5 years ago
|
val pop_exn : 'a list -> 'a * 'a list
|
||
|
|
||
|
val find_map_remove :
|
||
|
'a list -> f:('a -> 'b option) -> ('b * 'a list) option
|
||
|
|
||
|
val fold_option :
|
||
|
'a t -> init:'accum -> f:('accum -> 'a -> 'accum option) -> 'accum option
|
||
|
(** [fold_option t ~init ~f] is a short-circuiting version of [fold] that
|
||
|
runs in the [Option] monad. If [f] returns [None], that value is
|
||
|
returned without any additional invocations of [f]. *)
|
||
|
|
||
5 years ago
|
val map_endo : 'a t -> f:('a -> 'a) -> 'a t
|
||
|
(** Like map, but specialized to require [f] to be an endofunction, which
|
||
|
enables preserving [==] if [f] preserves [==] of every element. *)
|
||
5 years ago
|
|
||
|
val rev_map_unzip : 'a t -> f:('a -> 'b * 'c) -> 'b list * 'c list
|
||
|
(** [rev_map_unzip ~f xs] is [unzip (rev_map ~f xs)] but more efficient. *)
|
||
|
|
||
|
val remove_exn : ?equal:('a -> 'a -> bool) -> 'a list -> 'a -> 'a list
|
||
|
(** Returns the input list without the first element [equal] to the
|
||
5 years ago
|
argument, or raise [Not_found_s] if no such element exists. [equal]
|
||
5 years ago
|
defaults to physical equality. *)
|
||
|
|
||
|
val remove : ?equal:('a -> 'a -> bool) -> 'a list -> 'a -> 'a list option
|
||
|
val rev_init : int -> f:(int -> 'a) -> 'a list
|
||
|
|
||
|
val symmetric_diff :
|
||
5 years ago
|
compare:('a -> 'a -> int) -> 'a t -> 'a t -> ('a, 'a) Either.t t
|