If you have the befunge program 321&
,how would you access the first item (3) without throwing out the second two items?
The instruction \
allows one to switch the first two items, but that doesn't get me any closer to the last one...
The current method I'm using is to use the p
command to write the entire stack to the program memory in order to get to the last item. For example,
32110p20p.20g10g@
However, I feel that this isn't as elegant as it could be... There's no technique to pop the first item on the stack as N, pop the Nth item from the stack and push it to the top?
(No is a perfectly acceptable answer)