mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 19:55:31 -05:00
add -- to CCFQueue
This commit is contained in:
parent
0e62f9a345
commit
adcff57e4c
2 changed files with 14 additions and 0 deletions
|
|
@ -358,3 +358,12 @@ let rec _equal_klist eq l1 l2 = match l1(), l2() with
|
|||
eq x1 x2 && _equal_klist eq l1' l2'
|
||||
|
||||
let equal eq q1 q2 = _equal_klist eq (to_klist q1) (to_klist q2)
|
||||
|
||||
let (--) a b =
|
||||
let rec up_to q a b = if a = b
|
||||
then snoc q a
|
||||
else up_to (snoc q a) (a+1) b
|
||||
and down_to q a b = if a = b then snoc q a
|
||||
else down_to (snoc q a) (a-1) b
|
||||
in
|
||||
if a <= b then up_to empty a b else down_to empty a b
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ val map : ('a -> 'b) -> 'a t -> 'b t
|
|||
(** Map values *)
|
||||
|
||||
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
|
||||
(** Synonym to {!map} *)
|
||||
|
||||
val size : 'a t -> int
|
||||
(** Number of elements in the queue (constant time) *)
|
||||
|
|
@ -138,3 +139,7 @@ val of_seq : 'a sequence -> 'a t
|
|||
val to_klist : 'a t -> 'a klist
|
||||
val of_klist : 'a klist -> 'a t
|
||||
|
||||
val (--) : int -> int -> int t
|
||||
(** [a -- b] is the integer range from [a] to [b], both included.
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue