From 1b98749c650746a45d172429185e1221412a3a80 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 4 Jul 2014 02:02:03 +0200 Subject: [PATCH] constructors for 1 or 2 elements fqueues --- core/CCFQueue.ml | 3 +++ core/CCFQueue.mli | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/core/CCFQueue.ml b/core/CCFQueue.ml index 37420428..41df1639 100644 --- a/core/CCFQueue.ml +++ b/core/CCFQueue.ml @@ -56,6 +56,9 @@ let is_empty = function | Shallow Zero -> true | _ -> false +let singleton x = _single x +let doubleton x y = _double x y + let _empty = Lazy.from_val empty let rec cons : 'a. 'a -> 'a t -> 'a t diff --git a/core/CCFQueue.mli b/core/CCFQueue.mli index 55736b7a..397155c1 100644 --- a/core/CCFQueue.mli +++ b/core/CCFQueue.mli @@ -38,6 +38,10 @@ val empty : 'a t val is_empty : 'a t -> bool +val singleton : 'a -> 'a t + +val doubleton : 'a -> 'a -> 'a t + exception Empty val cons : 'a -> 'a t -> 'a t