performance - Scheme: Data serializing, efficient [and functional] -


I am serializing data that can be an integer, an object (list) with other nested objects, and keys In the choice of two ways to use the way, firstly, by constructing a byte vector, a big single byte vector is to be copied into calling functions; Second, to use any type of stream which I can write, in the end, despite the choice, I will be able to use the resulting binary array in any further process which may be, and live. I will compress the output data and send it through the network or I will write some part of it in a file.

I still want to be functional enough (or completely), I am using, though implementing any other plan.

Thank you.

Update:

Example that I have found a solution after which I have added so that the user can save some time while searching for the way to write data. ]

Byte writing and write-bytes are of special use when you have to write an octet.

  & gt; (Bytes? (Output-to-bytes (lambda (byte 42))) #t & gt; (Byte vector? (Output-to-bytes (lambda () (Byte 42))) # T & gt; (Byte vector-> U8-list (output-to-bytes (lambda (write 42 byte))) {42} & gt; (Byte-> List (output-to-bytes (lambda (42) (write-bytes (integer-> integer-bytes # x101CA75 4 #f #)))))) (42 1 202 117)   

You can just type write data for a port You can do this with all the values, in the form of a list that keeps everything if you have issues like cyclical data, where print-graphs to #t to handle settings properly, in Odi-may need a little tweaking. And if you want to move the output into a byte string, you can see the open-output-bytes , or the convenient output-to-byte function:

  (with-out-to-bytes (lambda () (type (value value 1 value 2 value 3)))  

This is not going to happen Compact a binary representation But if you are planning to compress the output in any way, then it does not make any difference.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -