package ke

  1. Overview
  2. Docs
type ('a, 'b) bigarray = ('a, 'b, Bigarray_compat.c_layout) Bigarray_compat.Array1.t

The type of the internal bigarray of t.

type ('a, 'b) blit = 'a -> int -> 'b -> int -> int -> unit

The type of the blit function.

type 'a length = 'a -> int

The type of the length function.

val push_exn : ('a, 'b) t -> blit:('src, ('a, 'b) bigarray) blit -> length:'src length -> ?off:int -> ?len:int -> 'src -> ('a, 'b) bigarray list * ('a, 'b) t

push_exn q ~blit ~length ?off ?len src blits elements in src to the given queue q at the end (like a fast iterative R.push). Default value of off is 0. Default value of len is length src - off. It returns a list of internal bigarrays which contain dst. If the given q does not have enough free space to write src, it raises Full and the given queue is unchanged.

val push : ('a, 'b) t -> blit:('src, ('a, 'b) bigarray) blit -> length:'src length -> ?off:int -> ?len:int -> 'src -> (('a, 'b) bigarray list * ('a, 'b) t) option

Same as push_exn but it returns None if it fails.

val keep_exn : ('a, 'b) t -> blit:(('a, 'b) bigarray, 'dst) blit -> length:'dst length -> ?off:int -> ?len:int -> 'dst -> unit

keep_exn q ~blit ~length ?off ?len dst blits elements of the given queue q in dst from the front to the end of dst (like a fast iterative R.pop_exn). Default value of off is 0. Default value of len is length dst - off. If the given q does not have enough elements to write on dst, it raises Empty. In any case, the given queue is unchanged.

val keep : ('a, 'b) t -> blit:(('a, 'b) bigarray, 'dst) blit -> length:'dst length -> ?off:int -> ?len:int -> 'dst -> unit option

Same as keep_exn but if it fails, it returns None.

val unsafe_shift : ('a, 'b) t -> int -> ('a, 'b) t

unsafe_shift q l discards l elements in the given queue q without any verification. Mostly used after keep_exn, if the last one does not raise Empty, it's safe to use it.

val shift_exn : ('a, 'b) t -> int -> ('a, 'b) t

shift_exn q l discards l elements in the given queue q. If q does not have enough elements, it raises Empty and the given queue is unchanged.

val shift : ('a, 'b) t -> int -> ('a, 'b) t option

Same as shift_exn but if it fails, it returns None.