The Cut Operator

Roger Hui




The text and examples assume ⎕io←1 . The cut operator works in either index-origin.
 

0.   Definition

Cut was defined by Iverson in [0, 1] and refined in J [2]; it is a dyadic operator whose left operand is a function and whose right operand is an integer scalar encoding the kind of cut. It has not been decided what glyph would be used to denote cut. For the nonce we use Cut .

The following definitions are adapted from the J Dictionary [2].

0.1   Monadic Cases

f Cut 0 ⊢y applies f to y after reversing y along each axis; it is equivalent to (⍉⎕io,⍪-⍴y) f Cut 0 ⊢y .

The fret 1⌷y (the leading major cell of y) marks the start of an interval of major cells of y ; the phrase f Cut 1 ⊢y applies f to each such interval. The phrase f Cut ¯1 ⊢y differs only in that frets are excluded from the result. In f Cut 2 and f Cut ¯2 the fret is the last major cell, and marks the ends of intervals.

The monads f Cut 3 and f Cut ¯3 apply f to tessellation by “maximal cubes”, that is, they are defined by their dyadic cases using the left argument (⍴⍴y)⍴⌊/⍴y .

0.2   Dyadic Cases

x f Cut 0 ⊢y applies f to a rectangle or cuboid of y with one vertex at the point in y indexed by v←1⌷x , and with the opposite vertex determined as follows: the dimension is |2⌷x , but the rectangle extends back from v along any axis j for which the index j⌷v is negative. Finally, the order of the selected cells is reversed along each axis k for which k⌷2⌷x is negative. If x is a vector or scalar, it is treated as the matrix ⍉⎕io,⍪x .

The frets in the dyadic cases 1 , ¯1 , 2 , and ¯2 are determined by the 1s in boolean vector x ; an empty vector x and non-zero ≢y indicate the entire of y . If x is the scalar 0 or 1 it is treated as (≢y)⍴x . In general, boolean vector j⊃x specifies how axis j is to be cut, with a scalar treated as (j⌷⍴y)⍴j⊃x .

f Cut 3 and f Cut ¯3 yield (possibly overlapping) tessellations. x f Cut ¯3 ⊢y applies f to each complete rectangle of size |2⌷x beginning at integer multiples of (each scalar of) the movement vector 1⌷x . As in f Cut 0 , reversal occurs along each axis for which the size 2⌷x is negative. The case of a vector or scalar x is equivalent to ⍉1,⍪x , and therefore provides a complete tessellation of size x . The case f Cut 3 differs in that shards of length less than |2⌷x are included.
 

1.   Examples

It would be instructive to figure out what each example does before reading its annotation.

1.1   0-Cut

The 0-cut selects rectangular subarrays, reversing each axis for which the specified length is negative.

   ⎕←x←4 10⍴⍳40
 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 27 28 29 30
31 32 33 34 35 36 37 38 39 40

   (⍉2 3,⍪3 4) ⊂Cut 0 ⊢x               ⍝ a1.0
┌───────────┐
│13 14 15 16│
│23 24 25 26│
│33 34 35 36│
└───────────┘

   (⍉2 3,⍪3 ¯4) ⊂Cut 0 ⊢x              ⍝ a1.1
┌───────────┐
│16 15 14 13│
│26 25 24 23│
│36 35 34 33│
└───────────┘

   3 ¯4 ⊂Cut 0 ⊢x                      ⍝ a1.2
┌───────────┐
│ 4  3  2  1│
│14 13 12 11│
│24 23 22 21│
└───────────┘

   ⊢Cut 0 ⊢x                           ⍝ a1.3
40 39 38 37 36 35 34 33 32 31
30 29 28 27 26 25 24 23 22 21
20 19 18 17 16 15 14 13 12 11
10  9  8  7  6  5  4  3  2  1

   (⍉2 ¯2,⍪3 6) ⊢Cut 0 ⊢x              ⍝ a1.4
14 15 16 17 18 19
24 25 26 27 28 29
34 35 36 37 38 39

1.2   ±1-Cut and ±2-Cut

The 1- and 2-cut partition according to a fret, 1s in a boolean left argument in the dyadic case or the leading major cell of the right argument in the monadic case. Frets specify the starts of partitions in the 1-cut and the ends in the 2-cut. The ¯1- and ¯2-cuts differ in excluding the frets.

   ⊂Cut 1 ⊢' Cogito, ergo sum.'        ⍝ a2.0
┌────────┬─────┬─────┐
│ Cogito,│ ergo│ sum.│
└────────┴─────┴─────┘

   {⊂⌽⍵}Cut 1 ⊢' Cogito, ergo sum.'    ⍝ a2.1
┌────────┬─────┬─────┐
│,otigoC │ogre │.mus │
└────────┴─────┴─────┘

   ⊂Cut ¯1 ⊢' Cogito, ergo sum.'       ⍝ a2.2
┌───────┬────┬────┐
│Cogito,│ergo│sum.│
└───────┴────┴────┘

   b←1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0
   b ⊂Cut 1 ⊢' Cogito, ergo sum.'      ⍝ a2.3
┌────────┬─────┬─────┐
│ Cogito,│ ergo│ sum.│
└────────┴─────┴─────┘

   ⊢Cut 1 ⊢' Cogito, ergo sum.'        ⍝ a2.4
 Cogito,
 ergo   
 sum.

   ⊢Cut ¯1 ⊢' Cogito, ergo sum.'       ⍝ a2.5       
Cogito,
ergo   
sum.   

   ≢Cut  1⍨ 1 0 1 0 0                  ⍝ a2.6
2 3

   ≢Cut ¯1⍨ 1 0 1 0 0                  ⍝ a2.7
1 2

   ⊂Cut 2 ⊢'Cogito,/ergo/sum./'        ⍝ a2.8
┌────────┬─────┬─────┐
│Cogito,/│ergo/│sum./│
└────────┴─────┴─────┘

   1 0 1 0 0 1 0 0 ⊂Cut 2 ⊢'chthonic'  ⍝ a2.9
┌─┬──┬───┐
│c│ht│hon│
└─┴──┴───┘

   1 0 1 0 0 1 0 0 +⌿Cut 2 ⊢8 3⍴⍳24    ⍝ a2.10
 1  2  3
11 13 15
39 42 45

   x←5 3⍴⍳15
   1 0 1 0 0 ⊂Cut 1 ⊢x                 ⍝ a2.11
┌─────┬────────┐
│1 2 3│ 7  8  9│
│4 5 6│10 11 12│
│     │13 14 15│
└─────┴────────┘
 
   (1 0 1 0 0) (1 1 0) ⊂Cut 1 ⊢x       ⍝ a2.12
┌──┬─────┐
│1 │2 3  │
│4 │5 6  │
├──┼─────┤
│ 7│ 8  9│
│10│11 12│
│13│14 15│
└──┴─────┘

   ⍬ (1 1 0) ⊂Cut 1 ⊢x                 ⍝ a2.13          
┌──┬─────┐
│ 1│ 2  3│
│ 4│ 5  6│
│ 7│ 8  9│
│10│11 12│
│13│14 15│
└──┴─────┘

   ⍬ ⊂Cut 1 ⊢x                         ⍝ a2.14
┌────────┐
│ 1  2  3│
│ 4  5  6│
│ 7  8  9│
│10 11 12│
│13 14 15│
└────────┘

1.3   ±3-Cut

The 3-cut provides tessellation. The ¯3-cut differs in excluding shards, cells less than the full size.

   ⎕←x←5 7⍴⍳35
 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 27 28
29 30 31 32 33 34 35

   (2 2⍴2 1 3 2) ⊂Cut 3 ⊢x             ⍝ a3.0
┌─────┬─────┬─────┬─────┬─────┬─────┬──┐
│ 1  2│ 2  3│ 3  4│ 4  5│ 5  6│ 6  7│ 7│
│ 8  9│ 9 10│10 11│11 12│12 13│13 14│14│
│15 16│16 17│17 18│18 19│19 20│20 21│21│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│15 16│16 17│17 18│18 19│19 20│20 21│21│
│22 23│23 24│24 25│25 26│26 27│27 28│28│
│29 30│30 31│31 32│32 33│33 34│34 35│35│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│29 30│30 31│31 32│32 33│33 34│34 35│35│
└─────┴─────┴─────┴─────┴─────┴─────┴──┘

   (2 2⍴2 1 ¯3 2) ⊂Cut 3 ⊢x            ⍝ a3.1
┌─────┬─────┬─────┬─────┬─────┬─────┬──┐
│15 16│16 17│17 18│18 19│19 20│20 21│21│
│ 8  9│ 9 10│10 11│11 12│12 13│13 14│14│
│ 1  2│ 2  3│ 3  4│ 4  5│ 5  6│ 6  7│ 7│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│29 30│30 31│31 32│32 33│33 34│34 35│35│
│22 23│23 24│24 25│25 26│26 27│27 28│28│
│15 16│16 17│17 18│18 19│19 20│20 21│21│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│29 30│30 31│31 32│32 33│33 34│34 35│35│
└─────┴─────┴─────┴─────┴─────┴─────┴──┘

   (2 2⍴2 1 3 ¯2) ⊂Cut 3 ⊢x            ⍝ a3.2
┌─────┬─────┬─────┬─────┬─────┬─────┬──┐
│ 2  1│ 3  2│ 4  3│ 5  4│ 6  5│ 7  6│ 7│
│ 9  8│10  9│11 10│12 11│13 12│14 13│14│
│16 15│17 16│18 17│19 18│20 19│21 20│21│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│16 15│17 16│18 17│19 18│20 19│21 20│21│
│23 22│24 23│25 24│26 25│27 26│28 27│28│
│30 29│31 30│32 31│33 32│34 33│35 34│35│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│30 29│31 30│32 31│33 32│34 33│35 34│35│
└─────┴─────┴─────┴─────┴─────┴─────┴──┘

   ¯3 2 ⊂Cut 3 ⊢x                      ⍝ a3.3
┌─────┬─────┬─────┬─────┬─────┬─────┬──┐
│15 16│16 17│17 18│18 19│19 20│20 21│21│
│ 8  9│ 9 10│10 11│11 12│12 13│13 14│14│
│ 1  2│ 2  3│ 3  4│ 4  5│ 5  6│ 6  7│ 7│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│22 23│23 24│24 25│25 26│26 27│27 28│28│
│15 16│16 17│17 18│18 19│19 20│20 21│21│
│ 8  9│ 9 10│10 11│11 12│12 13│13 14│14│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│29 30│30 31│31 32│32 33│33 34│34 35│35│
│22 23│23 24│24 25│25 26│26 27│27 28│28│
│15 16│16 17│17 18│18 19│19 20│20 21│21│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│29 30│30 31│31 32│32 33│33 34│34 35│35│
│22 23│23 24│24 25│25 26│26 27│27 28│28│
├─────┼─────┼─────┼─────┼─────┼─────┼──┤
│29 30│30 31│31 32│32 33│33 34│34 35│35│
└─────┴─────┴─────┴─────┴─────┴─────┴──┘

   ¯3 2 ⊂Cut ¯3 ⊢x                     ⍝ a3.4
┌─────┬─────┬─────┬─────┬─────┬─────┐
│15 16│16 17│17 18│18 19│19 20│20 21│
│ 8  9│ 9 10│10 11│11 12│12 13│13 14│
│ 1  2│ 2  3│ 3  4│ 4  5│ 5  6│ 6  7│
├─────┼─────┼─────┼─────┼─────┼─────┤
│22 23│23 24│24 25│25 26│26 27│27 28│
│15 16│16 17│17 18│18 19│19 20│20 21│
│ 8  9│ 9 10│10 11│11 12│12 13│13 14│
├─────┼─────┼─────┼─────┼─────┼─────┤
│29 30│30 31│31 32│32 33│33 34│34 35│
│22 23│23 24│24 25│25 26│26 27│27 28│
│15 16│16 17│17 18│18 19│19 20│20 21│
└─────┴─────┴─────┴─────┴─────┴─────┘

   life←{1⊖1⌽(-⍴⍵)↑5 6 7∊⍨(3 3 ,Cut ¯3⊢⍵)+.×9⍴1,⍨4⍴2}  
                                       ⍝ a3.5
   b←10 10⍴0
   b[2;3]←b[3;4]←b[4;2 3 4]←1          ⍝ a3.6

   {'.x'[1+life⍣⍵⊢b]}¨¯1+⍳10           ⍝ a3.7
┌──────────┬──────────┬──────────┬──────────┬──────────┬
│..........│..........│..........│..........│..........│
│..x.......│..........│..........│..........│..........│
│...x......│.x.x......│...x......│..x.......│...x......│
│.xxx......│..xx......│.x.x......│...xx.....│....x.....│
│..........│..x.......│..xx......│..xx......│..xxx.....│
│..........│..........│..........│..........│..........│
│..........│..........│..........│..........│..........│
│..........│..........│..........│..........│..........│
│..........│..........│..........│..........│..........│
│..........│..........│..........│..........│..........│
└──────────┴──────────┴──────────┴──────────┴──────────┴
      ┬──────────┬──────────┬──────────┬──────────┬──────────┐
      │..........│..........│..........│..........│..........│
      │..........│..........│..........│..........│..........│
      │..........│..........│..........│..........│..........│
      │..x.x.....│....x.....│...x......│....x.....│..........│
      │...xx.....│..x.x.....│....xx....│.....x....│...x.x....│
      │...x......│...xx.....│...xx.....│...xxx....│....xx....│
      │..........│..........│..........│..........│....x.....│
      │..........│..........│..........│..........│..........│
      │..........│..........│..........│..........│..........│
      │..........│..........│..........│..........│..........│
      ┴──────────┴──────────┴──────────┴──────────┴──────────┘

See [3] for more on the meaning of life.

1.4   Annotations

a1.0 rectangle at indices 2 3 with sizes 3 4
a1.1 rectangle at indices 2 3 with sizes 3 ¯4 (the ¯4 indicates reversal of axis 2)
a1.2 rectangle at indices 1 1 (default) with sizes 3 ¯4 (the ¯4 indicates reversal of axis 2)
a1.3 reverse each axis
a1.4 rectangle at indices 2 ¯2 with sizes 3 6 (the ¯2 indicates negative indexing)
 
a2.0 cut on leading blanks; applyto each cut
a2.1 cut on leading blanks; apply {⊂⌽⍵} to each cut
a2.2 cut on leading blanks; applyto each cut, excluding the leading blank
a2.3 cut on leading 1s in the left argument; applyto each cut
a2.4 cut on leading blanks; applyto each cut
a2.5 cut on leading blanks; applyto each cut, excluding the leading blank (this is the common vtom (vector to matrix) utility)
a2.6 cut on leading 1s in the left argument (↔ right argument because of the); applyto each cut
a2.7 cut on leading 1s in the left argument; applyto each cut, excluding the leading cell
a2.8 cut on trailing / (which specify the ends of the cuts); applyto each cut
a2.9 cut on trailing 1s in the left argument (which specify the ends of the cuts); applyto each cut
a2.10 cut on trailing 1s in the left argument (which specify the ends of the cuts); apply +⌿ to each cut
a2.11 cut on leading 1s in the left argument; applyto each cut
a2.12 cut using 1 0 1 0 0 on axis 0 and 1 1 0 on axis 1
a2.13 cut usingon axis 0 and 1 1 0 on axis 1
a2.14   cut usingon axis 0
 
a3.0 tessellate using movements 2 1 and sizes 3 2
a3.1 tessellate using movements 2 1 and sizes ¯3 2 (¯3 indicates reversal of axis 1 of each cut)
a3.2 tessellate using movements 2 1 and sizes 3 ¯2 (¯2 indicates reversal of axis 2 of each cut)
a3.3 tessellate using movements 1 1 (default) and sizes ¯3 2
a3.4 tessellate using movements 1 1 (default) and sizes ¯3 2 , excluding shards
a3.5 movements 1 1 (default) and sizes 3 3 , excluding shards; apply , to each cut
a3.6 “glider”
a3.7 game of life for 10 generations

2.   Model

Both the model and the tests work in either index-origin. See also [4].

 

Cut←{
 ⍝ Model of cut.  Works in either index-origin.
 ⍝ Iverson, K.E., Rationalized APL, 1983; Section K.
 ⍝ Hui, R.K.W., Some Uses of { and }, 1987-05; Section 3.2.
 ⍝ Iverson, K.E., A Dictionary of APL, 1987-09; m⍤v.
 ⍝ Hui, R.K.W., and K.E. Iverson, J Introduction and Dictionary, 2011, Cut (;.).

  ⍺←(|⍵⍵){                          ⍝ default left argument
    0=⍺:⍉⎕io,⍪-⍴⍵
    1=⍺:⎕io=( 1↑⍵)⍳⍵
    2=⍺:⎕io=(¯1↑⍵)⍳⍵
    3=⍺:(⍴⍴⍵)⍴⌊/⍴⍵
  }⍵

  ⍺ ⍺⍺{⍺⍺ ⍵}{
    ⎕ml←1                           ⍝ needed by ⊂

    Under←{⍵⍵⍣¯1⊢(⍵⍵ ⍺)⍺⍺(⍵⍵ ⍵)}    ⍝ dyadic case of "under" operator
    p2   ←{(¯1⌽k↓⍺)⊂[⎕io+⍺⍺]((⍺⍺⍴0),k←⎕io-(⌽⍺)⍳1)↓⍵}
    Blk1 ←{0=≢⍺:⍵ ⋄ 0=≢⊃⍺:(1↓⍺)((1+⍺⍺)∇∇)⍵ ⋄ (1↓⍺)((1+⍺⍺)∇∇)↑(⊂⊃⍺)⊂[⎕io+⍺⍺]¨⍵}
    Blk2 ←{0=≢⍺:⍵ ⋄ 0=≢⊃⍺:(1↓⍺)((1+⍺⍺)∇∇)⍵ ⋄ (1↓⍺)((1+⍺⍺)∇∇)↑(⊂⊃⍺)(⍺⍺ p2)  ¨⍵}
    ifv  ←{(⍉⍺,⍪)⍣(2>≢⍴⍵)⊢⍵}        ⍝ laminate ⍺ if ⍵ is vector or scalar
    ci   ←{(0>s){⌽⍣⍺⊢⍵}¨(⍳¨|s)+(((⍴i)↑⍴⍵)|i-⎕io×0≤i)-(0>i)ׯ1+|s⊣i s←↓⎕io ifv ⍺}
    ti   ←{{↑(⍵+⎕io)((×s)×(|s)⌊r-⍵)}¨m∘ר⎕io-⍨⍳⌈r       ÷m+(0=m)×r←(⍴m)⍴⍴⍵⊣m s←↓1 ifv ⍺}
    tj   ←{{↑(⍵+⎕io) s             }¨m∘ר⎕io-⍨⍳⌈(1+r-|s)÷m+(0=m)×r←(⍴m)⍴⍴⍵⊣m s←↓1 ifv ⍺}

    (1=|⍵⍵)∧(⍬≡⍺)∨1≠≡⍺:↑⍺⍺¨(⊂(0>⍵⍵)× ×≢¨⍺)↓¨⍺(0 Blk1)⊂⍵
    (2=|⍵⍵)∧(⍬≡⍺)∨1≠≡⍺:↑⍺⍺¨(⊂(0>⍵⍵)×-×≢¨⍺)↓¨⍺(0 Blk2)⊂⍵

     0=⍵⍵:⍺(⍺⍺ ci⌷⊢)⍵
     1=⍵⍵:↑⍺(⍺⍺      ¨⊂[⎕io])⍵
    ¯1=⍵⍵:↑⍺(⍺⍺∘(1∘↓)¨⊂[⎕io])⍵
     2=⍵⍵:⍺ ⍺⍺∘⊖∇∇ 1 Under⊖ ⍵
    ¯2=⍵⍵:⍺ ⍺⍺∘(¯1∘↓)∇∇ 2⊢⍵
     3=⍵⍵:↑(⍺ ti ⍵)⍺⍺ ∇∇ 0¨⊂⍵
    ¯3=⍵⍵:↑(⍺ tj ⍵)⍺⍺ ∇∇ 0¨⊂⍵

    *'domain error'
  }⍵⍵⊢⍵
}

(The above text for Cut illustrates why having the system preserve whitespace as entered is much to be desired and why ⎕io delenda est.)

2.1   Tests

assert ← {⍺←'assertion failure' ⋄ 0∊⍵:⍺ ⎕signal 8 ⋄ shy←0}

 z←test_cut io;⎕io;f;p;q;x
⍝ testing the cut operator

 ⎕io←io

 assert(⊂⌽3  4↑1  2↓x)≡(⍉(1 2+⎕io),   ⍪3 ¯4)⊂Cut 0⊢x←4 10⍴⍳40
 assert(⊂⌽3 ¯4↑1 ¯1↓x)≡(⍉((1+⎕io),¯2),⍪3 ¯4)⊂Cut 0⊢x
 assert(⊂⌽3 4↑x)≡3 ¯4⊂Cut 0⊢x
 assert'TUVWXY'≡(⍪¯2       6)⊢Cut 0⊢⎕a
 assert'YXWVUT'≡(⍪¯2      ¯6)⊢Cut 0⊢⎕a
 assert'BCDEFG'≡(⍪(1+⎕io), 6)⊢Cut 0⊢⎕a
 assert'GFEDCB'≡(⍪(1+⎕io),¯6)⊢Cut 0⊢⎕a
 assert(⊂Cut 0⊢x)≡(⍉,∘⍪-⍴x)⊂Cut 0⊢x←5 7 11⍴⍳385

 assert(' foo' ' upon' ' thee')≡⊂Cut  1⊢' foo upon thee'
 assert('foo'  'upon'  'thee' )≡⊂Cut ¯1⊢' foo upon thee'
 assert 0 1 1 0 1 0 0(+⌿Cut  1≡(↑∘(+⌿¨)⊂Cut  1))7 3⍴⍳21
 assert 0 1 1 0 1 0 0(+⌿Cut ¯1≡(↑∘(+⌿¨)⊂Cut ¯1))7 3⍴⍳21

 assert('foo,' 'upon,' 'thee,')≡⊂Cut  2⊢'foo,upon,thee,'
 assert('foo'  'upon'  'thee' )≡⊂Cut ¯2⊢'foo,upon,thee,'

 assert{(⌈(1+r-s)÷m)≡≢(⍪m,s)⊂Cut ¯3⍳r←47⊣m s←⍵}¨∘.,⍨+\10⍴1
 assert(+/∘,¨2 3⊂Cut ¯3⊢x)≡2 3(+/,)Cut ¯3⊢x←7 5⍴⍳35
 assert(+/∘,¨2 3⊂Cut  3⊢x)≡2 3(+/,)Cut  3⊢x
 assert(⊂Cut  3⊢x)≡(⍉1,⍪(⍴⍴x)⍴⌊/⍴x)⊂Cut  3⊢x←5 7 11⍴⍳385
 assert(⊂Cut ¯3⊢x)≡(⍉1,⍪(⍴⍴x)⍴⌊/⍴x)⊂Cut ¯3⊢x

 p←(1 0 1 0 0)(1 0 1 1 0 0 1)
 q←(0 1 0 0 1)(0 1 1 0 0 1 1)
 x←5 7⍴⍳35
 assert(p ⊂Cut  1⊢x)≡⍉¨↑(⊂(1+⎕io)⊃p)⊂Cut 1¨ ⍉¨ (⎕io⊃p)⊂Cut 1⊢x
 assert(q ⊂Cut  2⊢x)≡p ⊂Cut 1⊢x
 assert(p ⊂Cut ¯1⊢x)≡ 1  1∘↓¨p ⊂Cut 1⊢x
 assert(q ⊂Cut ¯2⊢x)≡¯1 ¯1∘↓¨q ⊂Cut 2⊢x
 x←7 8⍴⍳56
 q←⍬(0 0 1 1 0 1 0 0)
 assert(q⊂Cut 1⊢x)≡1 1 0 1 0 0 ⊂[1+⎕io] 0  2↓x
 q←⍬(1 0 1 0 0 1 0 0)
 assert(q⊂Cut 2⊢x)≡1 1 0 1 0 0 ⊂[1+⎕io] 0 ¯2↓x

 ⎕fx 'z←f y' 'z←⎕ml'
 assert(2⍴¨0 1 2 3)≡{⎕ml←⍵ ⋄ 1 0 0 1 0 f Cut 1⊢'abcde'}¨0 1 2 3

 z←1

3.   Special Code

It is contemplated that special code would be implemented for the following cases:

•  matrix right arguments in the ±3-cut
•  vector right arguments in the ±1-cut and ±2-cut
•  ⊂ Cut n
•  (⊂f) Cut n
•  ⊢ Cut n
•  , Cut n
•  dyad ≢ Cut n for ±1 and ±2
•  dyad f/ Cut n for ±1 and ±2 and vector right arguments

References

[0]   Iverson, K.E., Rationalized APL, I.P. Sharp Associates, 1983-01-06; revision 1, 1983-04-04; Section K.
[1]   Iverson, K.E., A Dictionary of APL, 1987, m⍤v .
[2]   Hui, R.K.W., and K.E. Iverson, J Introduction and Dictionary, 2011, Cut (;.) .
[3]   McDonnell, E.E., Life: Nasty, Brutish, and Short, APL88, APL Quote Quad, Volume 18, Number 2, 1987-12.
[4]   Hui, R.K.W., Some Uses of { and }, APL87, APL Quote Quad, Volume 17, Number 4, 1987-05, Section 3.2.


Presented at Dyalog ’15, Naxos Beach, Sicily, 2015-09-10.

created:  2014-12-08 16:00
updated: