Next: , Previous: , Up: Stack Manipulation   [Contents][Index]


5.6.1 Data stack

drop ( w – ) core “drop”
nip ( w1 w2 – w2 ) core-ext “nip”
dup ( w – w w ) core “dupe”
over ( w1 w2 – w1 w2 w1 ) core “over”
third ( w1 w2 w3 – w1 w2 w3 w1 ) gforth-1.0 “third”
fourth ( w1 w2 w3 w4 – w1 w2 w3 w4 w1 ) gforth-1.0 “fourth”
tuck ( w1 w2 – w2 w1 w2 ) core-ext “tuck”
swap ( w1 w2 – w2 w1 ) core “swap”
pick ( S:... u – S:... w ) core-ext “pick”

Actually the stack effect is x0 ... xu u -- x0 ... xu x0 .

rot ( w1 w2 w3 – w2 w3 w1 ) core “rote”
-rot ( w1 w2 w3 – w3 w1 w2 ) gforth-0.4 “not-rote”
?dup ( w – S:... w ) core “question-dupe”

Actually the stack effect is: ( w -- 0 | w w ). It performs a dup if w is nonzero.

roll ( x0 x1 .. xn n – x1 .. xn x0  ) core-ext “roll”
2drop ( w1 w2 – ) core “two-drop”
2nip ( w1 w2 w3 w4 – w3 w4 ) gforth-0.4 “two-nip”
2dup ( w1 w2 – w1 w2 w1 w2 ) core “two-dupe”
2over ( w1 w2 w3 w4 – w1 w2 w3 w4 w1 w2 ) core “two-over”
2tuck ( w1 w2 w3 w4 – w3 w4 w1 w2 w3 w4 ) gforth-0.4 “two-tuck”
2swap ( w1 w2 w3 w4 – w3 w4 w1 w2 ) core “two-swap”
2rot ( w1 w2 w3 w4 w5 w6 – w3 w4 w5 w6 w1 w2 ) double-ext “two-rote”

Next: Floating point stack, Previous: Stack Manipulation, Up: Stack Manipulation   [Contents][Index]