previous up next
Go backward to Concrete Stacks
Go up to Top
Go forward to Hiding the Representation
RISC-Linz logo

Generic Element Types

type GenericListStack =
   forall Item.
     {emptyStack: List[Item],
      push: (Item x List[Item]) -> List[Item]
      pop: List[Item] x List[Item],
      top: List[Item] -> Item}

value genericListStack: GenericListStack =
   all[Item]
     {emptyStack = nil[Item],
      push = fun(a: Item, s: List[Item]) cons[Item](a,s),
      pop = fun(s: List[Item]) tl[Item](s)
      top = fun(s: List[Item]) hd[Item](s)}

type GenericArrayStack =
   ...

value genericArrayStack: GenericArrayStack =
   ...


Author: Wolfgang Schreiner
Last Modification: May 27, 1998

previous up next