Skip to main content
November 6, 2014
Question

Can a HNA be used anywhere you'd use a regular array?

  • November 6, 2014
  • 1 reply
  • 565 views

I'm going to use some very large numeric arrays for lookup tables and such. Can I substitute ASCII85 encoded homogeneous number arrays? The arrays will only be accessed with the get operator, and will contain 16 or 32 bit integers, or floating point numbers.

This topic has been closed for replies.

1 reply

Legend
November 6, 2014

A homogeneous number array is a compact representation of an array. It is parsed once and then will have the same meaning and memory footprint as a regular array. How large is "very large"? There are limits on the number of elements in an array.

A more compact memory footprint for 16 or 32 bit numbers would be strings with packed numbers, since a single array element typically occupies 8 bytes.

November 6, 2014

Well that's how I thought it worked, but I can't get it to work. I either get Error: /undefined in ? (if I put cvx exec after it) or the interpreter seems to ignore the header and treats it as an encoded string (if I don't use exec). The array may contain several thousand numbers. For testing I tried a small array. I make a binary array starting with 149 32 00 78 followed by 78 16-bit values, then run that through /ASCII85Encode filter. I paste that into the source file and enclose it in <~ and ~>. So the interpreter should see that as ASCII85 encoded and decode it and have a regular array, right?

Legend
November 6, 2014

The interpreter should see that as an ASCII85 encoded string and decode it, giving you a string.