Randy wrote:
> an actual test would confirm or refute this [whether the]
> optimization results in a result smaller than what ": would give
I included such a test in the message you quoted:
> 5!:5{.;:'A'
> 29+14.5*i.1000000
> ":A
> 29 43.5 58 72.5 87 101.5 116 130.5 145 159.5 174 188.5 ...
Which confirms the optimized representation is smaller (and therefore quicker
to communicate).
Try it yourself:
A =: 29+14.5*i.1e6 NB. Test data
B =: 5!:5<'A' NB. Optimized
C =: ": A NB. Unoptimized
#B NB. 17 charaters
17
#C NB. ~10 million characters
9688888
7!:5<'B' NB. 64 bytes
64
7!:5<'C' NB. ~30 million bytes
3.35544e7
10 (6!:2) '5!:5<''A''' NB. ~1/20 seconds to calculate
0.0424283
10 (6!:2) '":A' NB. ~2 seconds to calculate
1.7645
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm