6.1.0430 2SWAP two-swap CORE

( 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 [40] Suggested reference implementationSuggested reference implementation2018-01-06 18:12:03

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

alextangentavatar of alextangent

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

Reply New Version

DavidJonesavatar of DavidJones [218] Implement with ROTSuggested reference implementation2022-01-28 10:17:58

: 2SWAP ROT >R ROT R> ;

I have a soft spot for the symmetry in this one.

AntonErtlavatar of AntonErtl

As decided at the 2022i meeting : This is the version we want to put in the document.

Closed
Reply New Version