Skip to content
kevinlawler edited this page Apr 1, 2011 · 2 revisions

a!b - mod/rotate

When the left argument is an atom (single value) and the right argument is a list, ! is rotate:

  2! 1 2 3 4 5 6 7    / positive: rotate left
3 4 5 6 7 1 2
  -2! 1 2 3 4 5 6 7   / negative: rotate right
6 7 1 2 3 4 5

Otherwise, ! is modulus:

  1 2 3 4 5!3  / n mod 3
1 2 0 1 2
  9!2
1
Clone this wiki locally