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


37.6 Searching in 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-for-all fun queue
Function: $queue-for-all fun queue

Apply the procedure fun over the objects in queue, starting from the front side; stop at the first application returning #f and return #f. If the iteration reaches the end of the queue: the return value is the result of applying fun to the last object in the queue. If the queue is empty: the return value is #t.

Function: queue-exists-left fun queue
Function: $queue-exists-left fun queue

Apply the procedure fun over the objects in queue, starting from the front side; stop at the first application returning true and return the returned value. If the queue is empty: the return value is #f.

Function: queue-exists-right fun queue
Function: $queue-exists-right fun queue

Apply the procedure fun over the objects in queue, starting from the rear side; stop at the first application returning true and return the returned value. If the queue is empty: the return value is #f.

Function: queue-exists fun queue
Function: $queue-exists fun queue

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

Function: queue-find-left fun queue
Function: queue-find-left fun queue not-found-rv
Function: $queue-find-left fun queue not-found-rv

Apply the procedure fun to the objects in queue, starting from the front side: stop at the first true value and return the object from queue that generated it.

When not-found-rv is not used: if all the applications return #f, the return value is #f.

When not-found-rv is used: if all the applications return #f, the return value is not-found-rv.

(queue-find-left
    even?
  (queue 1 3 5 7)
  'not-found)
⇒ not-found

(queue-find-left
    even?
  (queue 1 3 5 7))
⇒ #f

(queue-find-left
    even?
  (queue 1 3 5 6 7)
  'not-found)
⇒ 6
Function: queue-find-right fun queue
Function: queue-find-right fun queue not-found-rv
Function: $queue-find-right fun queue not-found-rv

Apply the procedure fun to the objects in queue, starting from the rear side: stop at the first true value and return the object from queue that generated it.

When not-found-rv is not used: if all the applications return #f, the return value is #f.

When not-found-rv is used: if all the applications return #f, the return value is not-found-rv.

Function: queue-find fun queue
Function: queue-find fun queue not-found-rv
Function: $queue-find fun queue not-found-rv

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


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