I'd be surprised if other implementations distinguish the storage format. As I
understand it, you call a function with a code (did not look up actual codes)
'b'yte array or 'l'iteral for a chunk of data. Data on disk is the same for
both, but 'b' code will transform the data with {&a.
----- Original Message -----
From: Jon Hough <[email protected]>
To: "[email protected]" <[email protected]>
Cc:
Sent: Friday, January 30, 2015 10:33 AM
Subject: Re: [Jprogramming] Byte Arrays vs Integer Arrays
I imagine that, for my purposes, what this means is since I cannot distinguish
a "byte array" from a string literal, that MessagePack serialization will have
to be slightly incomplete with regards to binary data.
Deserialization should not be a problem since, in general, the first byte of
the MsgPack data gives the datatype, so it is easy to distinguish byte data
from string data.
> From: [email protected]
> To: [email protected]
> Date: Fri, 30 Jan 2015 15:28:42 +0000
> Subject: Re: [Jprogramming] Byte Arrays vs Integer Arrays
>
> So, in J, if I am given a "byte array", e.g.
> let n =: a.{~ 101 14 29 76 100 NB. just some random values
>
> is it possibly to distinguish this from a literal?
> Doing
> datatype n
> gives
> 'literal'
>
> Also is a.{~ essentially casting an int to a char (in C)?
>
> > From: [email protected]
> > Date: Fri, 30 Jan 2015 09:49:42 -0500
> > To: [email protected]
> > Subject: Re: [Jprogramming] Byte Arrays vs Integer Arrays
> >
> > In J, a byte array is a literal array whose members are elements of
> > the a. constant.
> >
> > That said, the semantics of J are about giving us abstractions which
> > hold across some different storage formats.
> >
> > Meanwhile: if you ask different people "what are the essential
> > features of a type" you will get different (and yet vigorously
> > asserted) answers. [This depends on what language(s) they have been
> > working with, the kinds of problems they have been solving, the nature
> > of what they expect from other people, and the primary obstacles they
> > face.]
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Fri, Jan 30, 2015 at 9:28 AM, Jon Hough <[email protected]> wrote:
> > > 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
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm