4

It says Runs code protecting the top of the stack. but I’m not sure what is meant by that.

2 Answers 2

6

DIP lets you operate on the stack one level below the top element. You can think of DIP as taking the top element, putting it on an auxiliary stack, performing some operations on the remaining stack, and then placing the element from the auxiliary stack back on top.

3

DIP applies the sequence of instruction that follows it between braces to the stack below the top element. Similarly, DIIP will apply the sequence to the stack without its two topmost element etc. You can also think that you have two stacks, the fictitious one being used to hold the topmost elements of the real one until the sequence is over, then those elements are put back on top

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.