Simple Stack

In this exercise we will model a bounded stack using a sequence.

Variables

The spec should contain a single variable buffer, which is a sequence of values.

Initial State

Initially buffer should be the empty sequence <<>>.

Transitions

  • If the length of buffer is less than 3, any value in the set {1, 2, 3} can be appended to buffer.
  • If buffer is not empty, the last element can be removed from buffer.
simple-stack
Ready
⌘↵ to submit