2

How to get source of function for report generation, without copy pasting?

code(text) = println(text)

μ_model(period, vol_q, Q) = begin
  lp = log(period)
  exp(Q[1] + Q[2]lp + Q[3]vol_q)
end

code(source(μ_model))

That would produce same effect as copy paste

code("""
  μ_model(period, vol_q, Q) = begin
    lp = log(period)
    exp(Q[1] + Q[2]lp + Q[3]vol_q)
  end
""")

2 Answers 2

4

See CodeTracking.jl, specifically its @code_string.

Sign up to request clarification or add additional context in comments.

Comments

2
@less μ_model(period, vol_q, Q)

This will show function source code if it's defined in an included file. You need to provide actual parameters to let Julia detect what types it's calling.

Then it's vim. Use :q to exit.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.