In reading about mixture models in Distributions.jl, I found this code snippet: Normal[ Normal(-2.0, 1.2), Normal(0.0, 1.0), Normal(3.0, 2.5)]
This syntax is unfamiliar to me. The only documentation I can find is a brief mention in the Julia manual page for arrays about prepending a type to an array.
What does the Normal in front of the array in the above snippet do, in detail? Is there documentation somewhere?
A type declaration in front of the array limits what types can be stored in the array (usually for performance or error checking).
julia> c = [1, "Hello", 3]
3-element Vector{Any}:
1
"Hello"
3
julia> d = Float32[1, "Hello", 3]
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Float32
julia> eltype(c)
Any