Skip to content
Snippets Groups Projects
Unverified Commit f8ce7e87 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Apply alternate variable function to whole vector at once

parent 87a841d3
No related branches found
No related tags found
1 merge request!2Define variables through new @defvar macro
......@@ -343,7 +343,7 @@ end
function (var::AlternateVariable)(args...; kwargs...)
other_var = variables[var.other_var]
apply_from_other(res::VariableType) = var.from_other(res)
apply_from_other(res::AbstractArray{<:VariableType}) = var.from_other.(res)
apply_from_other(res::AbstractVector{<:VariableType}) = var.from_other(res)
apply_from_other(res::NamedTuple) = NamedTuple(k => apply_from_other(v) for (k, v) in pairs(res))
return apply_from_other(other_var(args...; kwargs...))
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment