Add partition_map to ListLabels.
parent
ca6f3ee057
commit
1a8aa5428e
|
@ -409,7 +409,8 @@ stdlib__listLabels.cmx : \
|
||||||
stdlib__list.cmx \
|
stdlib__list.cmx \
|
||||||
stdlib__listLabels.cmi
|
stdlib__listLabels.cmi
|
||||||
stdlib__listLabels.cmi : \
|
stdlib__listLabels.cmi : \
|
||||||
stdlib__seq.cmi
|
stdlib__seq.cmi \
|
||||||
|
stdlib__either.cmi
|
||||||
stdlib__map.cmo : \
|
stdlib__map.cmo : \
|
||||||
stdlib__seq.cmi \
|
stdlib__seq.cmi \
|
||||||
stdlib__map.cmi
|
stdlib__map.cmi
|
||||||
|
|
|
@ -318,6 +318,21 @@ val partition : f:('a -> bool) -> 'a list -> 'a list * 'a list
|
||||||
The order of the elements in the input list is preserved.
|
The order of the elements in the input list is preserved.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
val partition_map : f:('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list
|
||||||
|
(** [partition_map f l] returns a pair of lists [(l1, l2)] such that,
|
||||||
|
for each element [x] of the input list [l]:
|
||||||
|
- if [f x] is [Left y1], then [y1] is in [l1], and
|
||||||
|
- if [f x] is [Right y2], then [y2] is in [l2].
|
||||||
|
|
||||||
|
The output elements are included in [l1] and [l2] in the same
|
||||||
|
relative order as the corresponding input elements in [l].
|
||||||
|
|
||||||
|
In particular, [partition_map (fun x -> if p x then Left x else Right x) l]
|
||||||
|
is equivalent to [partition p l].
|
||||||
|
|
||||||
|
@since 4.12.0
|
||||||
|
*)
|
||||||
|
|
||||||
|
|
||||||
(** {1 Association lists} *)
|
(** {1 Association lists} *)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue