June 2019
Intermediate to advanced
218 pages
5h 19m
English
Type inference in Julia primarily works by inspecting the types of function parameters and identifying the type of the return value. This suggests that some type instability issues may be mitigated by breaking up a function into smaller functions. This can provide additional hints to the compiler, making more accurate type inferencing possible.
For an example of this, consider a contrived function that takes as input the string "Int64" or "Float64" and returns an array of 10 elements, the types of which correspond to the type name passed as the input argument. Functions such as this may arise when creating arrays based on user input or by reading a file in which the type of the output is determined at ...
Read now
Unlock full access