January 2020
Intermediate to advanced
532 pages
13h 31m
English
Before we dive into the specific patterns, let's first take a quick detour and discuss how and why we have a problem in the first place.
Suppose that we have defined a data type called Simulation to keep track of some scientific experiment data and related statistics. The syntax for it is as follows:
mutable struct Simulation{N} heatmap::Array{Float64, N} stats::NamedTuple{(:mean, :std)}end
A Simulation object contains an N-dimensional array of floating-point values and a named tuple of statistical values. For demonstration purposes, we will create a simple function to perform a simulation and create an object, as follows:
using Distributionsfunction simulate(distribution, dims, n) tp = ntuple(i ...
Read now
Unlock full access