Julia's Extended Tuple Interface

The following ArrayInterface functions extend Julia's tuple interface.

ArrayInterface.flatten_tuplesFunction
ArrayInterface.flatten_tuples(t::Tuple) -> Tuple

Flattens any field of t that is a tuple. Only direct fields of t may be flattened.

Examples

julia> ArrayInterface.flatten_tuples((1, ()))
(1,)

julia> ArrayInterface.flatten_tuples((1, (2, 3)))
(1, 2, 3)

julia> ArrayInterface.flatten_tuples((1, (2, (3,))))
(1, 2, (3,))
source
ArrayInterface.map_tuple_typeFunction
ArrayInterface.map_tuple_type(f, T::Type{<:Tuple})

Returns tuple where each field corresponds to the field type of T modified by the function f.

Examples

julia> ArrayInterface.map_tuple_type(sqrt, Tuple{1,4,16})
(1.0, 2.0, 4.0)
source