
Julia 1.0 Programming Cookbook
By :

Bymetaprogramming, we refer to the ability of a program to interact with its own code, where the code itself is represented in the data structures of that language. In Julia, this powerful functionality is available on many levels. In this recipe, we will introduce metaprogramming concepts by showing how Julia struct
data types can be generated automatically on the base of input data. This example could be useful in situations where some data has a structure which is not known in advance and subsequently needs to be processed and stored in Julia data structures.
For this recipe, no package installation is required. Simply start the Julia command line.
In the GitHub repository for this recipe, you will find the commands.txt
file that contains the presented sequence of Julia commands.
Consider a situation where we have some comma-separated data:
data=""" id,val,class 1,4,A 2,39,B 3,44,C """
This data could be contained in a file but, in our example...