Skip to content

How to get the name of a species? #1325

@oxinabox

Description

@oxinabox

Consider:

julia> using Catalyst

julia> t =  default_t()
t

julia> @species a(t)
1-element Vector{Num}:
 a(t)

julia> nameof(a)
ERROR: None Sym BasicSymbolic doesn't have a name
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] nameof(s::SymbolicUtils.BasicSymbolic{Real})
   @ SymbolicUtils ~/.julia/packages/SymbolicUtils/N76BL/src/types.jl:545
 [3] nameof(n::Num)
   @ Symbolics ~/.julia/packages/Symbolics/lJiB2/src/num.jl:108
 [4] top-level scope
   @ REPL[4]:1

Now if i am willing to do evil i can do:

julia> a.val.f.name
:a

Which is what i wanted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions