Character arrays are smaller than standard ones:

A tiny test:

    #foo =: 3!:1 a.{~i.256 NB. all bytes
304
    #bar =: 3!:1 i. 256 NB. same, but in number format
2088

Taking a look at the output of 3!:3 tells you why.

So I guess if you are implementing MessagePack because of it's short
representation, this is a good way to store 0 - 255 (aka all bytes).


2015-01-30 15:28 GMT+01:00 Jon Hough <[email protected]>:

> As I said in an earlier thread, I am attempting to write a MessagePack
> implementation in J.
> Spec: https://github.com/msgpack/msgpack/blob/master/spec.md#formats-bin
> Home: http://msgpack.org/
>
> In the spec there must be a way to serialize/deserialize byte arrays.
> However, in J what is a byte array? And how would you differentiate it from
> an integer array (0 ~ 255)?
> I may be absolutely mistaken, but there seems to be a little ambiguity
> between these types in J (well there is no byte type).
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to