Next: , Previous: , Up: queues   [Index]


37.5 Mapping over queues

The following syntactic bindings are exported by the library (vicare containers queues). The syntactic bindings whose name is prefixed with $ are unsafe operations: they do not validate their arguments before accessing them.

Function: queue-map-left dst-queue fun src-queue
Function: $queue-map-left dst-queue fun src-queue

Iterate over all the objects in src-queue, starting from the front side, apply fun to them, push the result of the application in the rear side of dst-queue.

(queue->list
  (queue-map-left (queue) - (queue 0 1 2 3)))
⇒ (0 -1 -2 -3)

The dst-queue argument allows us to build the destination queue with the desired configuration parameters.

Function: queue-map-right dst-queue fun src-queue
Function: $queue-map-right dst-queue fun src-queue

Iterate over all the objects in src-queue, starting from the rear side, apply fun to them, push the result of the application in the front side of dst-queue.

(queue->list
  (queue-map-right (queue) - (queue 0 1 2 3)))
⇒ (0 -1 -2 -3)

The dst-queue argument allows us to build the destination queue with the desired configuration parameters.

Function: queue-map fun queue
Function: $queue-map fun queue

Aliases for queue-map-left and $queue-map-left.

Function: queue-for-each-left fun queue
Function: $queue-for-each-left fun queue

Iterate over all the objects in queue, starting from the front side, and apply fun to them discarding the return value.

Function: queue-for-each-right fun queue
Function: $queue-for-each-right fun queue

Iterate over all the objects in queue, starting from the rear side, and apply fun to them discarding the return value.

Function: queue-for-each fun queue
Function: $queue-for-each fun queue

Aliases for queue-for-each-left and $queue-for-each-left.


Next: , Previous: , Up: queues   [Index]