make astuple more general

This commit is contained in:
Mike J Innes 2016-11-17 11:27:17 +00:00
parent 3e42db0cdf
commit b2d9514a9a

View File

@ -1,11 +1,15 @@
using DataFlow: interpret, interpret, interptuple, interplambda, interpconst, Context using DataFlow: interpret, interpret, interptuple, interplambda, interpconst, Context
function astuple(xs) function astuple(xs::Vertex)
isconstant(xs) && isa(value(xs).value, Tuple) ? value(xs).value : isconstant(xs) && isa(value(xs).value, Tuple) ? value(xs).value :
isa(xs, Vertex) && value(xs) == tuple ? inputs(xs) : isa(xs, Vertex) && value(xs) == tuple ? inputs(xs) :
nothing nothing
end end
astuple(xs::Tuple) = xs
astuple(xs) = nothing
function astuples(xs) function astuples(xs)
xs = [astuple(x) for x in xs] xs = [astuple(x) for x in xs]
all(x->!(x==nothing), xs) ? xs : nothing all(x->!(x==nothing), xs) ? xs : nothing