From e68b951db598837d55e8c5e5a281a29ee5e67536 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 25 May 2015 14:43:08 +0200 Subject: [PATCH] add `CCList.cons` function --- src/core/CCList.ml | 2 ++ src/core/CCList.mli | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/core/CCList.ml b/src/core/CCList.ml index f8a82c3b..d2704c10 100644 --- a/src/core/CCList.ml +++ b/src/core/CCList.ml @@ -59,6 +59,8 @@ let (>|=) l f = map f l let direct_depth_append_ = 10_000 +let cons x l = x::l + let append l1 l2 = let rec direct i l1 l2 = match l1 with | [] -> l2 diff --git a/src/core/CCList.mli b/src/core/CCList.mli index 201a2112..70f44bee 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -41,6 +41,10 @@ val (>|=) : 'a t -> ('a -> 'b) -> 'b t (** Infix version of [map] with reversed arguments @since 0.5 *) +val cons : 'a -> 'a t -> 'a t +(** [cons x l] is [x::l] + @since NEXT_RELEASE *) + val append : 'a t -> 'a t -> 'a t (** Safe version of append *)