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.
57 lines
1.8 KiB
57 lines
1.8 KiB
(*
|
|
* 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.
|
|
*)
|
|
|
|
open Import0
|
|
include module type of Core.List
|
|
|
|
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
|
|
|
|
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]. *)
|
|
|
|
val map_preserving_phys_equal : 'a t -> f:('a -> 'a) -> 'a t
|
|
(** Like map, but preserves [phys_equal] if [f] preserves [phys_equal] of
|
|
every element. *)
|
|
|
|
val filter_map_preserving_phys_equal : 'a t -> f:('a -> 'a option) -> 'a t
|
|
(** Like filter_map, but preserves [phys_equal] if [f] preserves
|
|
[phys_equal] of every element. *)
|
|
|
|
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
|
|
argument, or raise [Not_found] if no such element exists. [equal]
|
|
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 :
|
|
compare:('a -> 'a -> int) -> 'a t -> 'a t -> ('a, 'a) Either.t t
|