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 65535
I 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.py to 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.

Mathematica::Serializer v0.2.0

Serializer of Raku objects and expressions into Mathematica (aka Wolfram Language) expressions.

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Mathematica::Deserializer
  • Mathematica::Deserializer::WXF
  • Mathematica::Serializer
  • Mathematica::Serializer::Encoder
  • Mathematica::Serializer::WXF

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite β€” the markup and publishing tools behind this site.