You may find this helpful: http://www.jsoftware.com/jwiki/DevonMcCormick/Data/JInternalRepresentation .
On Tue, Jan 20, 2015 at 11:29 AM, 'Pascal Jasmin' via Programming < [email protected]> wrote: > Its packed as a string that J can read on other platforms. Getting a noun > between python and J could be done with CSV or Json, or perhaps having > python parse the 3!:1 format. > > > ----- Original Message ----- > From: Jon Hough <[email protected]> > To: "[email protected]" <[email protected]> > Cc: > Sent: Tuesday, January 20, 2015 11:08 AM > Subject: Re: [Jprogramming] J Equivalent of Python Struct.Pack/Unpack > > It looks very convenient. I'm reading through it now. > I'm wondering how it handles J hex. > I know the J verbs > dfh and > hfd > can convert decimal to hex and vice versa. But the hex representation is a > string literal. > So this would be packed as a string, right? > And if I sent this over a network, and unpacked in, say, Python, there > could be a problem it seems. > > > Date: Tue, 20 Jan 2015 15:47:15 +0000 > > From: [email protected] > > To: [email protected] > > Subject: Re: [Jprogramming] J Equivalent of Python Struct.Pack/Unpack > > > > 3!:1 is more powerful than this. Converts any noun to a binary (string) > representation. 3!:2 unpacks. > > > > > > ----- Original Message ----- > > From: Jon Hough <[email protected]> > > To: "[email protected]" <[email protected]> > > Cc: > > Sent: Tuesday, January 20, 2015 10:42 AM > > Subject: [Jprogramming] J Equivalent of Python Struct.Pack/Unpack > > > > Python has a useful module called struct > > https://docs.python.org/2/library/struct.html > > which is useful for converting strings to packed binary data. > > e.g. > > data = struct.pack('B', someHexString) > > > > Does J have an equivalent or similar function / verb? > > I spent a bit of time looking, but couldn't find anything. > > > > Example usage would be sending data over a network. > > > > > > > > ---------------------------------------------------------------------- > > 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 > -- Devon McCormick, CFA ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
