#[unsafe(no_mangle)]pub unsafe extern "C" fn patch_seq_roll(stack: Stack) -> StackExpand description
Roll: Rotate n+1 items, bringing the item at depth n to the top ( x_n x_(n-1) … x_1 x_0 n – x_(n-1) … x_1 x_0 x_n )
Examples:
- roll(0) is a no-op (rotate 1 item)
- roll(1) is equivalent to swap (rotate 2 items)
- roll(2) is equivalent to rot (rotate 3 items)
- roll(3) rotates 4 items: ( a b c d 3 – b c d a )
This is the standard Forth ROLL word.
§Safety
Stack must have the depth parameter (Int) on top, and at least n+1 values below it