May 2019
Beginner to intermediate
466 pages
10h 44m
English
Julia defines corresponding dot operations for every binary operator. These are designed to work element-wise with collections of values (called vectorized). That is, the operator that is dotted is applied for each element of the collection.
In the following example, we'll square each element of the first_five_fib collection:
julia> first_five_fib = [1, 1, 2, 3, 5]
5-element Array{Int64,1}:
1
1
2
3
5 julia> first_five_fib .^ 2
5-element Array{Int64,1}:
1
1
4
9
25
In the previous example, first_five_fib was not touched and the resultant collection was returned, but dotted updating operators are also available, updating the values in place. They match the previously discussed update operators (with the added dot ...
Read now
Unlock full access