Interesting how it doesn't work for sparse arrays. I thought it was impossible to have boxed elements in sparse arrays, but: (j7)
<@afd"0 $. 0 0 4 0 3 2 │ ┌─┐ 4 │ │\004│ │ ├─┤ │ │\003│ │ └─┘ it compresses to an answer, but that answer seems wrong. You can use compresslr on the sparse array, or compresslistnum on the non-sparse version: decompresslistnum compresslistnum 0 0 4 0 3 0 0 4 0 3 compresslistnum 0 0 4 0 3 AA AA CA AA B\200 3!:2 compresslr $. 0 0 4 0 NB. does not meet length threshold to actually compress any included numeric list ┌───────────────────────────────────────────┬───┬─┬───┬─┬─┬─┬──┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0│4 3│(│2 4│)│}│1│$.│(│,│5│)│;│(│,│0│)│;│0│+│-│~│2│ └───────────────────────────────────────────┴───┴─┴───┴─┴─┴─┴──┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘ ________________________________ From: Brian Schott <[email protected]> To: Pascal J <[email protected]> Sent: Friday, March 28, 2014 4:05:59 AM Subject: Re: [Jprogramming] compressing numeric lists [offline] Pascal, These compressions seem pretty slick. I am not sure you claim this works or not. decompresslistnum compresslistnum $. 0 0 4 0 3 |domain error: cut -- (B=) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
