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
👀 Reading hidden code
e = EditMe("asdfasdfasdfasdfasdfasdfasdfasdf")
13.5 μs
👀 Reading hidden code
Enter cell code...
70.0 μs
👀 Reading hidden code
begin
# wow i spent a really long time writing this comment!!!
EditMe("")
end
20.0 μs
👀 Reading hidden code
using HypertextLiteral
: @htl, @htl_str

24.0 ms
EditMe (generic function with 1 method)
👀 Reading hidden code
function EditMe(initial)
@htl("""
<script>
const init = $(initial)
const el = html`<input>`
el.value = init
const cm = currentScript.closest("pluto-cell").querySelector(".CodeMirror").CodeMirror
el.addEventListener("input", () => {
const old_value = cm.getValue()
const new_command = `EditMe(\${JSON.stringify(el.value)})`
cm.setValue(old_value.replace(/EditMe\\(\\".*\\"\\)/, new_command))
})
return el
</script>
""")
end
466 ms
Error message

UndefVarError: kjasdlkfjasdlkjf not defined

Stack trace

Here is what happened, the most recent locations are first:

  1. df = kjasdlkfjasdlkjf
df = kjasdlkfjasdlkjf
👀 Reading hidden code
---
Error message

Multiple definitions for can_drink

Combine all definitions into a single reactive cell using a `begin ... end` block.

Everything is going to be okay!
can_drink = df["age"] .> 18
👀 Reading hidden code
---
Error message

Multiple definitions for can_drink

Combine all definitions into a single reactive cell using a `begin ... end` block.

Silly computer!
can_drink = map(zip(df["first name"], df["last name"])) do (first, last)
first * ", " * last
end
👀 Reading hidden code
---
Error message

Another cell defining df and can_drink contains errors.

uhmmmmmm??!
[df; can_drink]
👀 Reading hidden code
---
Error message

syntax: incomplete: premature end of input

nb =
👀 Reading hidden code
---
Error message

UndefVarError: nb not defined

Stack trace

Here is what happened, the most recent locations are first:

  1. nb(;x = 123)
nb(;x = 123)
👀 Reading hidden code
---
Error message

UndefVarError: nb not defined

map(nb, df)
👀 Reading hidden code
---