From fcd4d3f6ec78458220e6e6c1eec0f83ac8c6aaf1 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 19 Apr 2024 09:51:42 -0400 Subject: [PATCH] add `cons_when` to `CCListLabels` --- src/core/CCListLabels.mli | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index fe5d2176..48e3072d 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -44,6 +44,11 @@ val cons_maybe : 'a option -> 'a t -> 'a t [cons_maybe None l] is [l]. @since 0.13 *) +val cons_when : bool -> 'a -> 'a t -> 'a t +(** [cons_when true x l] is [x :: l]. + [cons_when false x l] is [l]. + @since NEXT_RELEASE *) + val filter : f:('a -> bool) -> 'a t -> 'a t (** [filter ~f l] returns all the elements of the list [l] that satisfy the predicate [f]. The order of the elements