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


38.6 Searching in deques

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

Function: deque-for-all fun deque
Function: $deque-for-all fun deque

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

Function: deque-exists-left fun deque
Function: $deque-exists-left fun deque

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

Function: deque-exists-right fun deque
Function: $deque-exists-right fun deque

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

Function: deque-exists fun deque
Function: $deque-exists fun deque

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

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

Apply the procedure fun to the objects in deque, starting from the front side: stop at the first true value and return the object from deque 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.

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

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

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

Apply the procedure fun to the objects in deque, starting from the rear side: stop at the first true value and return the object from deque 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: deque-find fun deque
Function: deque-find fun deque not-found-rv
Function: $deque-find fun deque not-found-rv

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


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