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

Provide BODY #54

Open
cstjean opened this issue Mar 13, 2018 · 4 comments
Open

Provide BODY #54

cstjean opened this issue Mar 13, 2018 · 4 comments

Comments

@cstjean
Copy link

cstjean commented Mar 13, 2018

Sometimes, short functions are best documented by their full definition (and sometimes I'm just lazy). It would be nice if $(BODY) was replaced with log(p / (1 - p)).

""" Logistic regression, $(BODY) """
logit(p) = log(p / (1 - p))
@mortenpi
Copy link
Member

mortenpi commented Mar 26, 2018

Not sure how easy it is to actually get the function body through the Julia APIs?

@cstjean
Copy link
Author

cstjean commented Mar 26, 2018

I thought that this was all part of a macro and that the Expr was available...

Not sure how easy it is to actually get the function body through the Julia APIs?

Doesn't look so good JuliaLang/julia#24347

@cstjean
Copy link
Author

cstjean commented Apr 5, 2018

julia> Core.atdoc!((args...)->(global dbg = args))
(::#1) (generic function with 1 method)

julia> @doc """ Testing """ f(x, y=2; z=3) = "hello" * y
(" Testing ", :(f(x, y=2; z=3) = begin  # REPL[2], line 1:
            "hello" * y
        end))

Seems like it's available after all, and it's just a matter of extracting it from the AST.

@MichaelHatherly
Copy link
Member

Will be pretty simple to add once #133 is merged.

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

No branches or pull requests

3 participants