Skip to content

Instantly share code, notes, and snippets.

@reallyasi9
Created March 6, 2023 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reallyasi9/78f4487c8d34060b1fe2928368848f6c to your computer and use it in GitHub Desktop.
Save reallyasi9/78f4487c8d34060b1fe2928368848f6c to your computer and use it in GitHub Desktop.
Julia: LIST ALL THE THINGS!
"""
list_all_things(module::Module, [type::Type]) -> Vector{Symbol}
List all the things of a given `type` in `module`. If `type` is not given, all things will be listed.
"""
function list_all_things(m::Module, T::Type)
return filter(s -> typeof(eval(s)) <: T, names(m))
end
list_all_things(m::Module) = names(m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment