Skip to main content
3 of 4
added 75 characters in body
Digital Trauma
  • 73k
  • 9
  • 112
  • 264

#GNU dc, 6 (3x2)

I think this is the shortest answer not to require the "mod 90°" rule-relaxation:

3z1
0p2

Outputs 0, 1, 2 or 3 for each rotation.

For the 0, 2 and 3 rotations, the p simply pops and prints the last number literal to have been pushed to the stack. For the 1 rotation, the z pushes the current stack depth (1) to the stack, then the p pops and prints it.

Digital Trauma
  • 73k
  • 9
  • 112
  • 264