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


46.5 Common stacks API for stacks

The library (vicare containers stacks) provides an implementation of the stack container using the <stack> type, Stacks of objects. The library (vicare containers istacks stacks) provides a concrete implementation of the <istack> type using an instance of <stack> as storage. Usage example:

(import (vicare)
  (vicare containers stacks)
  (vicare containers istacks)
  (vicare containers istacks stacks))

(define S
  (make-istack-stack (stack)))

(istack-push! S 0)
(istack-push! S 1)
(istack-push! S 2)

(istack-top  S)         ⇒ 2
(istack-pop! S)         ⇒ 2
(istack-pop! S)         ⇒ 1

The following syntactic bindings are exported by the library (vicare containers istacks stacks).

Record Type: <istack-stack>

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

Function: make-istack-stack stack

Build and return a new instance of <istack-stack>. The argument stack must be an instance of type <stack>.

Function: istack-stack? obj

Return #t if obj is an instance of <istack-stack>; otherwise return #f.