Skip to content
silentbicycle edited this page Apr 1, 2011 · 3 revisions

a _ b - drop/cut

For a sorted list of indexes a and list of values b, cut b into sublists from each index to the next index - 1; for the last, include the remainder of the list. When a is only one value, this has the effect of dropping the first a[0] values. One negative value drops from the end; more than one negative value is an error.

  3_!30   / drop 3 from 0..29, 0 to 2
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  -3_!30  / drop 3 from end, 27 to 29
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

  3 5 10_!30   / break 0..29 into b[3 to 4], b[5 to 9], b[10 to end]
(3 4
 5 6 7 8 9
 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29)