# Command: roll

NEST HelpDesk | Command Index | NEST Quick Reference

Name:

    roll - Roll a portion n stack levels k times

Synopsis:

    objn ... obj1 n k roll

Examples:

      (a) (b) (c) 3 1  roll -> (c) (a) (b)
      (a) (b) (c) 3 -1 roll -> (b) (c) (a)
      (a) (b) (c) 3 0  roll -> (a) (b) (c)

Description:

      roll performs a circular shift of the first n stack levels
      by k positions. Before this is done, roll removes its arguments
      from the stack.

      If k is positive, each shift consists of moving the contents of level
      0 to level n-1, thereby moving elements at levels 1 through n-1 up one
      stack level.

      If k is negative, each shift consists of moving the contents of level
      n-1 to level 0, thereby moving elements at levels 1 through n-1 down
      one stack level.

Diagnostics:

    Raises StackUnderflow error if there are less than n+2 objects
      on the stack.

SeeAlso:

- exch
- rollu
- rolld
- rot

Source:

    /opt/conda/conda-bld/nest_1512418773968/work/nest-2.14.0/sli/slistack.cc

NEST HelpDesk | Command Index | NEST Quick Reference

© 2004 The NEST Initiative