Previous: , Up: ideques   [Index]


48.4 Dynamic arrays as deques

The library (vicare containers ideques dynamic-arrays) provides a concrete implementation of the <ideque> type using a dynamic array as storage; dynamic arrays are defined by the library (vicare containers dynamic-arrays), Dynamic arrays. Usage example:

(import (vicare)
  (vicare containers dynamic-arrays)
  (vicare containers ideques)
  (vicare containers ideques dynamic-arrays))

(define S
  (make-ideque-dynamic-array (dynamic-array)))

(ideque-push-front! S 0)
(ideque-push-rear!  S 1)

(ideque-front S)        ⇒ 0
(ideque-rear  S)        ⇒ 1
(ideque-pop-front! S)   ⇒ 0
(ideque-pop-rear!  S)   ⇒ 1

The following syntactic bindings are exported by the library (vicare containers ideques dynamic-arrays).

Record Type: <ideque-dynamic-array>

Record type implementing an <ideque>, of which it is a subtype.

Function: make-ideque-dynamic-array arry

Build and return a new instance of <ideque-dynamic-array>. The argument arry must be an instance of type <dynamic-array> as defined by the library (vicare containers dynamic-arrays).

Function: ideque-dynamic-array? obj

Return #t if obj is an instance of <ideque-dynamic-array>; otherwise return #f.