julia> data = :( a::Foo, b::Bar, c :: Foo, d:: Bar )
:((a::Foo, b::Bar, c::Foo, d::Bar))
@match data begin
:($([:($a :: $b) for (a, b) in pack]...), ) => pack
end
4-element Vector{Tuple{Any, Any}}:
(:a, :Foo)
(:b, :Bar)
(:c, :Foo)
(:d, :Bar)
Iād suggest using the Expr pattern because :($(pat...), ) is not-that readable.
julia> @match data begin
Expr(:tuple, [:($a :: $b) for (a, b) in pack]...) => pack
end
4-element Vector{Tuple{Any, Any}}:
(:a, :Foo)
(:b, :Bar)
(:c, :Foo)
(:d, :Bar)