You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
p_stored =:p
rn =@reaction_networkbegin@parameters$(p_stored)
(p, d), 0<--> X
end
it returns a
ERROR: LoadError: AssertionError: @parameters expects a tuple of expressions or an expression of a tuple (`@parameters x y z(t) v[1:3] w[1:2,1:4]` or `@parameters x y z(t) v[1:3] w[1:2,1:4] k=1.0`)
Stacktrace:
[1] _parse_vars(macroname::Symbol, type::Type, x::Vector{Any}, transform::Function)
@ Symbolics ~/.julia/packages/Symbolics/3ueSK/src/variable.jl:136
[2] _parse_vars
@ ~/.julia/packages/Symbolics/3ueSK/src/variable.jl:82 [inlined]
[3] extract_syms(opts::Dict{Symbol, Expr}, vartype::Symbol)
@ Catalyst ~/.julia/dev/Catalyst/src/reaction_network.jl:469
...
(I have checked on the master branch)
The problem is in this function:
functionextract_syms(opts, vartype::Symbol)
ifhaskey(opts, vartype)
ex = opts[vartype]
vars = Symbolics._parse_vars(vartype, Real, ex.args[3:end])
syms =Vector{Union{Symbol, Expr}}(vars.args[end].args)
else
syms = Union{Symbol, Expr}[]
endreturn syms
end
where ex.args[3:end] becomes $(Expr(:escape, :p_stored)))].
There is also weird stuff going on a deeper level. E.g. shouldn't
p_stored =:p@parameters$(p_stored)
p
work? Here, the first two lines is fin,e but the last gives ERROR: UndefVarError: p not defined.
The text was updated successfully, but these errors were encountered:
Ahh, right there is no reason to interpolate into @parameters in the DSL since you are expected to just create the parameter externally in that case and then interpolate the symbolic itself into the reaction that uses it.
In your example the symbolic is the first entry in the vector @parameters returns, but it isn't loaded into scope:
julia> a =:b:b
julia> pv =@parameters$a
1-element Vector{Num}:
b
julia> pv[1]
b
That is fine and how it has always worked. So if you can match that behavior with the macro outside the DSL we are good. Inside the DSL we don't need interpolation since we can just require the parameter to have been created outside and the symbolic interpolated in.
I think this is supposed to be a correct syntax?
it returns a
(I have checked on the master branch)
The problem is in this function:
where
ex.args[3:end]
becomes$(Expr(:escape, :p_stored)))]
.There is also weird stuff going on a deeper level. E.g. shouldn't
work? Here, the first two lines is fin,e but the last gives
ERROR: UndefVarError:
pnot defined
.The text was updated successfully, but these errors were encountered: