When encountering a problem whose input is meant to be read sequentially, but you may also want to push back onto the input like a stack, which languages have the optimal boilerplates for doing so, and how?
For example, from Create a Boolean Calculator, we have a string like:
We want to "pop" 5 chars
1AND0, compute it to be
0, then "push" it back to form:
Then, repeat until there's only 1 char left. In this case:
It's trivial to write
while loops and such, but this seems common enough in codegolf problems that there must be canonical forms. I wasn't able to find a tips question specifically about this setup though, and going through each tips question by language was difficult.