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
using PlutoUI
156 ms

Start both clocks:

and wait 6 seconds

👀 Reading hidden code
229 μs
image/svg+xml image/svg+xml image/svg+xml speed:
👀 Reading hidden code
@bind reset Clock(Δt)
40.0 ms

Run superclock:

👀 Reading hidden code
md"""Run superclock: $(@bind do_clock html"<input type=checkbox>")"""
223 ms
👀 Reading hidden code
if do_clock === true
end
659 μs

Reached 0.0 ticks per second

👀 Reading hidden code
let
freq = num_ticks[] / Δt
num_ticks[] = 0

md"Reached **$(freq) ticks per second**"
end
5.9 ms
👀 Reading hidden code
num_ticks = Ref(0)
13.7 μs
Error message

UndefVarError: trigger not defined

Stack trace

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

  1. let	trigger	num_ticks[] += 1
let
trigger
num_ticks[] += 1
end
👀 Reading hidden code
---
3
Δt = 3
👀 Reading hidden code
11.5 μs
supertimer = html"""
<script>
let i = 0

const handle = setInterval(() => {
i += 1
currentScript.value = i
currentScript.dispatchEvent(new CustomEvent("input"))
}, 1)

invalidation.then(() => {
clearInterval(handle)
})

</script>
""";
👀 Reading hidden code
31.7 μs