prompts
WXF serializer
In this Raku package "Mathematica::Serializer" implement the class `Mathematica::Serializer::WXF`
that serializes Raku objects to Wolfram Language (WL) with the binary format WXF.
I have provided the description of WXF in the file "./resources/WXFFormatDescription.txt".
In the directory "Python" I have provided the WXF serialization code of the Python package "wolframclient".
Use that code for reference -- you do not have to follow it, but borrow ideas from it.
Write corresponding tests. It is very important to be able to serialize Raku arrays of hashmaps -- they are correspond to WL's `Dataset` objects.Make sure last test in "./t/02-wxf-serializer.t" works.
Right now with larger data I get from encode-to-wxf errors like:
> Flattened array has 86478 elements, but argument lists are limited to 65535I want to be able to specify to `export-to-wxf` that I want a string.
Then in Wolfram Langauge I can import that string with `ImportString[fromRaku, 'WXF']`.WXF deserializer
Write the class `Mathematica::Deserializer::WXF` that deserializes WXF byte-arrays or strings into Raku expressions.
Reuse `Mathematica::Serializer::WXF` if appropriate.Make a separate test file "./xt/04-wxf-round-trip.rakutest" in which this dataset is exported to a local .wxf file in the TEMP directory,
the content of which is then ingested, deserialized and compared with the Raku original:
```raku
my $n = 2_000;
my @ds = (^$n).map({
%(score => 100.rand,
name => ('a' ... 'z').roll,
color => <red blue green brown>.roll)
});
``` Package development
Did at any point of your code generations the Python code I provided helped?Yes, but only as a reference during deserializer work. I inspected Pythonβs
wxfencoder/constants.pyto confirm:
WXF token byte values
Numeric/packed-array type tokens
Element sizes
Valid packed-array types, especially complex-number arrays
The Raku implementation itself was written independently; no Python code was translated or executed. The supplied WXF format description was the primary reference.