January 2020
Intermediate to advanced
532 pages
13h 31m
English
The ugliness of the preceding columnar struct left us in a very unsatisfied state. Not only do we need to create a new data type with tons of Vector fields, we also have to create a constructor function to convert our array of structs into the new type.
We can recognize the power of Julia when we get to use powerful packages in its ecosystem. To fully implement this pattern, we will introduce the StructArrays.jl package, which automates most of the mundane tasks in turning an array of structs into a struct of arrays.
In fact, the usage of StructArrays is embarrassingly simple:
using StructArrayssa = StructArray(records)
Let's take a quick look at the content. First of all, we can treat sa just like the original ...
Read now
Unlock full access