Next: , Previous: , Up: dynamic arrays   [Index]


40.6 Searching in dynamic arrays

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

Function: dynamic-array-for-all fun arry
Function: $dynamic-array-for-all fun arry

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

Function: dynamic-array-exists-left fun arry
Function: $dynamic-array-exists-left fun arry

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

Function: dynamic-array-exists-right fun arry
Function: $dynamic-array-exists-right fun arry

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

Function: dynamic-array-exists fun arry
Function: $dynamic-array-exists fun arry

Aliases for dynamic-array-exists-left and $dynamic-array-exists-left.

Function: dynamic-array-find-left fun arry
Function: dynamic-array-find-left fun arry not-found-rv
Function: $dynamic-array-find-left fun arry not-found-rv

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

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

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

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

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

Aliases for dynamic-array-find-left and $dynamic-array-find-left.


Next: , Previous: , Up: dynamic arrays   [Index]