Created
March 6, 2023 20:23
-
-
Save reallyasi9/78f4487c8d34060b1fe2928368848f6c to your computer and use it in GitHub Desktop.
Julia: LIST ALL THE THINGS!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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