Help / Release / J 4.06 / ~. Sparse Arguments
< Help
Jump to navigation
Jump to search
>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release
~. Sparse Arguments |
initial writing: 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 | 3 1 0 | 1 1 1 | 2 3 0 | 2 3 1 | 2 4 0 | 3 4 1 | 1 5 0 | 2 5 1 | 3 6 1 | 1 7 0 | 3 7 1 | 3 8 0 | 2 9 0 | 2 9 1 | 1 ~. d 0 3 1 2 0 0 2 2 3 1 2 3 0 1 3 3 2 0 2 1 p=: ?.100$1e9 q=: (?.100$20){?.20 5$10 s=: q p}1 $. 1e9 5 ; 0 ; 2-2 $s 1000000000 5 t=: ~. s $t 21 5 ($t) -: $ ~.0,q 1 (2$.t) -: ,0 1 (3$.t) -: 0 1 (4$.t) -: ,. (i.#t)-.{.(i.1+#p) -. p 1 (5$.t) -: ~.q/:p 1