dmbiro
dmbiro

Reputation: 23

How can I get a list of objects of a specific types contained in a Julia session?

I have defined several variables working in Julia. Now I would like to list those variables which are dictionaries (and hence are of Dict type)

How do I list all variables of a specific type within a Julia REPL session?

Upvotes: 1

Views: 180

Answers (1)

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42234

I assume that you want to get a list of all dictionaries defined in your Julia session.

Supposing you have a=Dict() and b=Dict() you can find them with the following code:

julia> [f for f in names(Main) if getfield(Main,f) isa AbstractDict]
2-element Vector{Symbol}:
 :a
 :b

Upvotes: 3

Related Questions