Reading material

Pages 49-51.

Additional material

  size(nil) = 0
  size(push(X, S)) = size(S) = 1
  size(error) = error

  empty(nil) = true
  empty(push(X, S)) = false
  empty(error) = error

  top(nil) = error
  top(push(X, S)) = X
  top(error) = error

  pop(nil) = error
  pop(push(X, S)) = S
  pop(error) = error
Question

Exercise 5.4