#GNU dc, 6 (3x2)
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.