To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 20 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
hello (generic function with 1 method)
👀 Reading hidden code
function hello(x)
y = x
123
y
end
421 μs

Welcome to Julia!

👀 Reading hidden code
142 ms
:(function hello(x)
      #= none:1 =#
      #= none:2 =#
      y = x
      #= none:3 =#
      123
      #= none:4 =#
      y
  end)
👀 Reading hidden code
method_code_expr = get_expr_for(@which hello(123))
102 ms
get_expr_for (generic function with 1 method)
👀 Reading hidden code
function get_expr_for(m::Method)
notebookcode = read(justthefilename(m.file), String)
method_cellid = justthecellid(m.file)
all_cells_kindof = split(notebookcode, "# " * "╔═╡ ")
m_cell_code = all_cells_kindof[findfirst(startswith(method_cellid), all_cells_kindof)]
method_code_raw = strip(split(m_cell_code, method_cellid)[2])
method_code_expr = Meta.parse(method_code_raw)
end
869 μs
👀 Reading hidden code
using PlutoUI
178 ms
contains_head (generic function with 1 method)
👀 Reading hidden code
contains_head(expr::Any, head::Symbol) = false
390 μs
contains_head (generic function with 2 methods)
contains_head(expr::Expr, head::Symbol) = if expr.head === head
true
else
any(contains_head.(expr.args, [head]))
end
👀 Reading hidden code
600 μs
justthecellid (generic function with 1 method)
justthecellid(s) = split(String(s), "#==#")[2]
👀 Reading hidden code
406 μs
justthefilename (generic function with 1 method)
justthefilename(s) = split(String(s), "#==#")[1]
👀 Reading hidden code
433 μs