Go backward to Combining Universal and Existential Quantification
Go up to Top
Go forward to Generic Element Types

Concrete Stacks

type IntListStack =
  {emptyStack: List[Int],
   push: (Int x List[Int]) -> List[Int]
   pop: List[Int] x List[Int],
   top:List[Int] -> Int}

value intListStack: IntListStack =
  {emptyStack = nil[Int],
   push = fun(a: Int, s: List[Int]) cons[Int](a,s),
   pop = fun(s: List[Int]) tl[Int](s)
   top = fun(s: List[Int]) hd[Int](s)}

type IntArrayStack =
  {emptyStack: (Array[Int] x Int),
   push: (Int x (Array[Int] x Int)) -> (Array[Int] x Int),
   pop: (Array[Int] x Int) x (Array[Int] x Int),
   top:(Array[Int] x Int) -> Int}

value intArrayStack: IntArrayStack =
  {emptyStack = (Array[Int](100), -1) ...}


Wolfgang.Schreiner@risc.uni-linz.ac.at
Id: understand.tex,v 1.1 1996/06/12 09:38:21 schreine Exp schreine

Prev Up Next