Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List currently defined variables in REPL #8

Open
mahiki opened this issue Aug 5, 2024 · 1 comment
Open

List currently defined variables in REPL #8

mahiki opened this issue Aug 5, 2024 · 1 comment

Comments

@mahiki
Copy link
Owner

mahiki commented Aug 5, 2024

Kinda like dir() in python, its nice to just list the defined variables in the session so far.
Not module ones, just Main, I think.

Good example implementation from Mustache.jl docs:

_names = String[]
_summaries = String[]
for s in sort(map(string, names(Main)))
    v = Symbol(s)
    if isdefined(Main,v)
        push!(_names, s)
        push!(_summaries, summary(eval(v)))
    end
end

using DataFrames
d = DataFrame(names=_names, summs=_summaries)

out = Mustache.render(tpl, TITLE="A quick table", D=d)
print(out)
@mahiki
Copy link
Owner Author

mahiki commented Aug 5, 2024

names(Main)                    # gives list of defined names
summary(<variable>)      # details of type definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant