Help / Release / J 4.06 / i. Sparse Arguments

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



i. Sparse Arguments

initial writing: 2001-02-21
last updated: 2001-04-12


The dyad i. now supports sparse arguments, as do verbs based on it:

dyad:  -.  e.  i:  f/.
monad: =  ~.  ~:


For example:

   v=: 1 3 5 7 9
   ] i =: v i. $. i.2 3
0 1 | 0
0 2 | 5
1 0 | 1
1 1 | 5
1 2 | 2
   $.^:_1 i
5 0 5
1 5 2
   (v i. i.2 3) -: v i. $. i. 2 3
1
   ($.i.2 3) e. v
0 1 | 1
0 2 | 0
1 0 | 1
1 1 | 0
1 2 | 1

   ] x=: (i.3 4) * ?. 3 4$2
0 1  0  3
0 0  6  7
8 0 10 11
   $. x
0 1 |  1
0 3 |  3
1 2 |  6
1 3 |  7
2 0 |  8
2 2 | 10
2 3 | 11
   ] i=: v i. $. x
0 1 | 0
0 3 | 1
1 2 | 5
1 3 | 3
2 0 | 5
2 2 | 5
2 3 | 5
   $.^:_1 i
5 0 5 1
5 5 5 3
5 5 5 5
   (v i. x) -: v i. $. x
1

   ] d=: (?.13$8) { (?.8$2) * ?.8 3$10
5 2 0
0 4 6
3 5 8
0 0 0
5 2 0
0 0 0
0 0 0
0 0 0
5 9 8
3 5 8
0 0 0
0 4 6
0 0 0
   ] s=: $. d
 0 0 | 5
 0 1 | 2
 1 1 | 4
 1 2 | 6
 2 0 | 3
 2 1 | 5
 2 2 | 8
 4 0 | 5
 4 1 | 2
 8 0 | 5
 8 1 | 9
 8 2 | 8
 9 0 | 3
 9 1 | 5
 9 2 | 8
11 1 | 4
11 2 | 6

   s i. 0 0 0
3
   s i: 0 0 0
12
   s i. 5 9 8 , 0 4 6 ,: 999
0 |  8
1 |  1
2 | 13
   s i. s
 0 | 0
 1 | 1
 2 | 2
 4 | 0
 8 | 8
 9 | 2
11 | 1
   s i: s
 0 |  4
 1 | 11
 2 |  9
 4 |  4
 8 |  8
 9 |  9
11 | 11
   3 $. s i. s
3
   3 $. s i: s
12

   d i. 0 0 0
3
   d i: 0 0 0
12
   d i. 5 9 8 , 0 4 6 ,: 999
8 1 13
   d i. d
0 1 2 3 0 3 3 3 8 2 3 1 3
   d i: d
4 11 9 12 4 12 12 12 8 9 12 11 12



>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release