working map interp

This commit is contained in:
Mike J Innes 2016-11-15 20:46:01 +00:00
parent 46aa456bd1
commit d86225ca47
1 changed files with 6 additions and 7 deletions

View File

@ -11,15 +11,14 @@ function astuples(xs)
all(x->!(x==nothing), xs) ? xs : nothing
end
# function interp(ctx, ::typeof(map), f, xs...)
# f = interpret(ctx, f)
# xs = interpret(ctx, xs)
# xs = astuples(xs)
# xs == nothing ? constant(:MAPFAIL) : @show map(f, xs...)
# end
function interp(ctx, ::typeof(map), f, xs...)
f = interpret(ctx, f)
xs = interpret(ctx, xs)
xs = astuples(xs)
xs == nothing ? vertex(map, constant(f), xs...) : group(map(f, xs...)...)
end
function interp(ctx, model, xs...)
@show model
g = graph(model)
g == nothing && return vertex(model, map(constant, interpret(ctx, xs))...)
interpret(ctx, g, xs...)