Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print a docstring of a program to stdout in Julia

Julia accepts ?sin on the command line to display a help text. I believe such help texts are implemented as docstrings. I would like to print such docstrings from my Julia program at runtime. How to do that?

like image 904
TradingDerivatives.eu Avatar asked Oct 16 '25 18:10

TradingDerivatives.eu


1 Answers

julia> @doc sin
  sin(x)

  Compute sine of x, where x is in radians.

  sin(A::AbstractMatrix)

  Compute the matrix sine of a square matrix A.

  If A is symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the
  sine. Otherwise, the sine is determined by calling exp.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> sin(fill(1.0, (2,2)))
  2×2 Matrix{Float64}:
   0.454649  0.454649
   0.454649  0.454649
like image 131
Jun Tian Avatar answered Oct 18 '25 20:10

Jun Tian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!