Help / Release / J 4.06 / ~: Sparse Arguments

From J Wiki
Jump to navigation Jump to search


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



~: Sparse Arguments

initial writing: 2001-04-05
last updated: 2001-04-05


The monad ~: now supports sparse arguments. For example:

   ] d=: ?. 15 2$4 
0 3
1 2
0 0
2 2
3 1
2 3
0 0
2 2
0 1
0 1
2 2
3 3
2 0
2 1
2 3
   s=: $. d

   (~: s) -: ~: d
1
   ~: s
 0 | 1
 1 | 1
 2 | 1
 3 | 1
 4 | 1
 5 | 1
 8 | 1
11 | 1
12 | 1
13 | 1
   ~: d
1 1 1 1 1 1 0 0 1 0 0 1 1 1 0

   p=: ?.100$1e9
   q=: (?.100$20){?.20 5$10
   s=: q p}1 $. 1e9 5 ; 0 ; 2-2
   $s
1000000000 5
   t=: ~: s
   $t
1000000000
   +/t
21
   t -: 1 ((s i. 5$0),(~:q/:p)#p/:p)} 1 $. 1e9;0;0
1

   (~.s) -: (~:s)#s
1



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