>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  Help  Primer

Selecting without from

Some situations where you could use { (from) are so common that they have their own primitives. These primitives are not dealt with in any detail here, and are mentioned so that you are aware of them and can look up their definitions and make use of them in your own work. They are shown here by example.

The monad {. (head) takes the first item of its argument and is similar to { with a left argument of 0.
   {. 5 6 7
5
   {. i. 3 4
0 1 2 3
The monad {: (tail) takes the last item of its argument and is similar to { with a left of _1 (oh yes, forgot to mention earlier that negative indexes simply index from the end of the axis).
   {: 5 6 7
7
   {: i. 3 4
8 9 10 11
The monad }. (behead) drops the first item of its argument.
   }. 5 6 7
6 7
   }. i. 3 4
4 5  6  7
8 9 10 11
The monad }: (curtail) drops the last item of its argument.
   }: 5 6 7
5 6
   }: i. 3 4
0 1 2 3
4 5 6 7
The dyad {. (take) takes the indexes from axes as indicated by the left argument.
   3 {. i. 8
0 1 2
   2 3 {. i. 3 4
0 1 2
4 5 6
   2 {. i. 3 4
0 1 2 3
4 5 6 7
The dyad }. (drop) drops the indexes from axes as indicated by the left argument.
   1 }. 2 3 4
3 4
   1 2 }. i. 3 4
 6  7
10 11
An interesting way to think of {. {: }. and }: is that they are indexing corners of the array.

One capability that the dyad {. has that is not so directly related to from is it can create an array that is larger than the selected corner. It does this by filling in with 0, ' ', or a: as appropriate.
   5 {. 5 6 7
5 6 7 0 0
   4 5 {. i. 2 3
0 1 2 0 0
3 4 5 0 0
0 0 0 0 0
0 0 0 0 0
   5 {. 'abc'   
abc  
   <"0 [ 5 {. 'abc'	NB. make sure they are there
+-+-+-+-+-+
¦a¦b¦c¦ ¦ ¦
+-+-+-+-+-+
   7 {. (<"0) 5 {. 'abc'	NB. fill with a:
+-+-+-+-+-+++
¦a¦b¦c¦ ¦ ¦¦¦
+-+-+-+-+-+++ 
The dyad # (copy) is also fairly directly related to from. Its left argument is a list of how many times to repeat the corresponding item from the right argument.
   3 2 1 2 3 # 'abcde'
aaabbcddeee
The above is equivalent to the following:
   0 0 0 1 1 2 3 3 4 4 4 { 'abcde'
aaabbcddeee

>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  Help  Primer