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

46.2 Built–in lists as stacks

The library (vicare containers istacks lists) provides a concrete implementation of the <istack> type using built–in lists as storage. Usage example:

(import (vicare)
  (vicare containers istacks)
  (vicare containers istacks lists))

(define S

(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 lists).

Record Type: <istack-list>

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

Function: make-istack-list
Function: make-istack-list ell

Build and return a new instance of <istack-list>. The optional argument ell must be a proper list (or null) representing the initial contents of the stack, with the car of the list being the top object.

Function: istack-list? obj

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

Function: istack-list-first-pair istack

Return null or the first pair of the list used as storage in the <istack-list> instance istack.