Pancode - Commands - Stack Shuffling

The following commands shuffle the top few elements of the stack. Many of these take a numerical modifier which specifies how deep within the stack to operate.

Duplicate (:)

Duplicates the top element of the stack. If provided a numerical modifier N, this command instead duplicates the top N elements of the stack. For example,

1 2 3 :③

The final stack will be 1 2 3 1 2 3

Pop (%)

Pops a value off the stack and discards it. With a numerical modifier N, pops N values off the stack and discards all of them.

Swap / Rotate (@)

Pops two values off the stack and pushes them back in the opposite order. If given a numerical modifier N, this command instead rotates the top of the stack, taking the Nth element (0-based) and placing it at the top of the stack. For example,

1 2 3 4 @③

The final stack will be 2 3 4 1.

Over (ø)

Pushes a copy of the second-from-the-top value of the stack onto the top. Example:

1 2 ø

The final stack will be 1 2 1.

With a numerical modifier N, the command instead duplicates the Nth element down the stack (0-based). Example:

1 2 3 4 ø②

The final stack will be 1 2 3 4 2.

Documentation Index