Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Don't overwrite Base.vect for numbers with a different implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Nov 2, 2018
1 parent f111790 commit 3b0cd7a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/atoms/affine/stack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,15 @@ function hvcat(rows::Tuple{Vararg{Int}}, args::AbstractExprOrValue...)
return vcat(rs...)
end

_isexpr(x::Union{T,Type{T}}) where {T<:AbstractExpr} = true
_isexpr(x) = false

Base.vect(args::T...) where {T<:AbstractExpr} = transpose(HcatAtom(map(transpose, args)...))
Base.vect(args::AbstractExpr...) = transpose(HcatAtom(map(transpose, args)...))
Base.vect(args::AbstractExprOrValue...) = transpose(HcatAtom(map(arg -> transpose(convert(AbstractExpr, arg)), args)...))
Base.vect(args::Value...) = collect(args)

function Base.vect(args::AbstractExprOrValue...)
if any(_isexpr, args)
transpose(HcatAtom(map(arg -> transpose(convert(AbstractExpr, arg)), args)...))
else
invoke(Base.vect, Tuple{Vararg{Any}}, args...)
end
end

0 comments on commit 3b0cd7a

Please sign in to comment.