make astuple more general

This commit is contained in:
Mike J Innes 2016-11-17 11:27:17 +00:00
parent 3e42db0cdf
commit b2d9514a9a
1 changed files with 5 additions and 1 deletions

View File

@ -1,11 +1,15 @@
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 :
isa(xs, Vertex) && value(xs) == tuple ? inputs(xs) :
nothing
end
astuple(xs::Tuple) = xs
astuple(xs) = nothing
function astuples(xs)
xs = [astuple(x) for x in xs]
all(x->!(x==nothing), xs) ? xs : nothing