Revert
Revert
Stack | Position | Description |
---|---|---|
Stack(In) | Top | a vector |
Stack(Out) | Top | Vector with reversed order of elements |
reverses the order of the elements of the vector on the stack:
[ a b c ] -> [ c b a ]
Attention: If the vector is stored in a variable, from now on the variable also points to the reversed vector!
/ Define the vector Var(vector) [ 1 2 3 ] -> vector // Get the first element of the vector 0 vector GetElement // You will get the 1 (the first inserted object) // Turn around the vector and drop the result from the stack vector Revert Drop // Get the first element of the vector again 0 vector GetElement // You will get the 3 (the last inserted object)