[stack] "tick" stack shuffling notation
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
Here's a silly idea for another stack shuffling notation. The idea is that the top of the stack is always 'z', the element below is 'y', the element below that is 'x', and so on. The notation specifies the result of the shuffle, but *not* the precondition. It is assumes that all variables above the lowest one used were initially on the stack. In other words, if you write '`x', it is assumed the input stack was 'xyz', so '`x' is the same as '2drop'. This causes a problem for certain words like 'nip' (which can't be expressed with one shuffle), but most work quite well. Hopefully you're using monospace fonts in your email client. SHUFFLE MNEMONIC TICK z-- drop `y yz-- 2drop `x xyz-- 3drop `w yz--z nip `zy `y xyz--z 2nip `zxy `x z--zz dup `zz z--zzz dup dup `zzz yz--yzyz 2dup `yzyz yz--yzyzyz 3dup `yzyzyz yz--yyz dupd `yyz yz--yzy over `yzy xyz--xyzx pick `xyzx yz--zyz tuck `zyz yz--zy swap `zy xyz--yxz swapd `yxz xyz--zyx spin `zyx xyz--yzx rot `yzx xyz--zxy -rot `zxy wxyz--xyzw roll `xyzw wxyz--zwxy -roll `zwxy - John