package ocaml-base-compiler
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=72fa3d0ba19b82fcb9e6c62e0090b9d22e5905c4be0f94faf56904a9377a9e5b
doc/stdlib/Stdlib/Queue/index.html
Module Stdlib.QueueSource
First-in first-out queues.
This module implements queues (FIFOs), with in-place modification.
Unsynchronized accesses
Unsynchronized accesses to a queue may lead to an invalid queue state. Thus, concurrent accesses to queues must be synchronized (for instance with a Mutex.t).
The type of queues containing elements of type 'a.
Raised when Queue.take or Queue.peek is applied to an empty queue.
take q removes and returns the first element in queue q, or raises Empty if the queue is empty.
take_opt q removes and returns the first element in queue q, or returns None if the queue is empty.
peek q returns the first element in queue q, without removing it from the queue, or raises Empty if the queue is empty.
peek_opt q returns the first element in queue q, without removing it from the queue, or returns None if the queue is empty.
iter f q applies f in turn to all elements of q, from the least recently entered to the most recently entered. The queue itself is unchanged.
fold f accu q is equivalent to List.fold_left f accu l, where l is the list of q's elements. The queue remains unchanged.
transfer q1 q2 adds all of q1's elements at the end of the queue q2, then clears q1. It is equivalent to the sequence iter (fun x -> add x q2) q1; clear q1, but runs in constant time.
Iterators
Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration.
Add the elements from a sequence to the end of the queue.