I’m writing some simple functions with combinatorial flavor (derived from IBM’s research language FL), but they cannot be used as needed by the intrusive type conversion.
julia> function DISTL(args)
Element, List = args
return [Number[Element, e] for e in List]
end
DISTL (generic function with 1 method)
julia> DISTL([100, [10., 20., 30.]])
3-element Vector{Vector{Number}}:
[100, 10.0]
[100, 20.0]
[100, 30.0]
Here’s another version that creates a type Union.
julia> function DISTL(args)
Element, List = args
T = Union{typeof(Element), eltype(List)}
return [T[Element, e] for e in List]
end
DISTL (generic function with 1 method)
julia> DISTL([100, [10., 20., 30.]])
3-element Vector{Vector{Union{Float64, Int64}}}:
[100, 10.0]
[100, 20.0]
[100, 30.0]