2SWAP

( x1 x2 x3 x4 -- x3 x4 x1 x2 )

Exchange the top two cell pairs.

Testing:

T{ 1 2 3 4 2SWAP -> 3 4 1 2 }T

ContributeContributions

NieDzejkobavatar of NieDzejkob Suggested reference implementationSuggested reference implementation2018-01-06 18:12:03

: 2SWAP >R -ROT R> -ROT ;

alextangentavatar of alextangent 2018-01-08 15:43:39

-ROT is not in the standard. A reference implementation should (must?) use standard words.

Reply