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 2 minutes 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
overflow (generic function with 1 method)
👀 Reading hidden code
509 μs
jl (generic function with 1 method)
👀 Reading hidden code
451 μs

👀 Reading hidden code
25.5 μs











👀 Reading hidden code
9.1 μs

✨ Pluto 1.0 ✨ in Fall 2021

👀 Reading hidden code
235 ms
👀 Reading hidden code
92.7 μs

github.com/fonsp/Pluto.jl

👀 Reading hidden code
56.2 μs

Thank you ❤️


Nicholas Bochenski Παναγιώτης Γεωργακόπουλος Michiel Dral Paul Berg Benjamin Lungwitz Connor Burns Rogerluo Eric Zhang Felipe S. S. Schneider Luka van der Plas Glen Hertz Eric Hanson Shuhei Kadowaki Jerry Ling Jelmar Gerritsen Rok Novosel Supanat Zachary Moon pupuis Michael Abbott Nicholas Bauer Patrick Bouffard Shashank Polasa TheCedarPrince fghzxm karlwessel Ciarán O'Mara Rik Huijzer Aayush Joglekar Alexis Chris Foster Dhruva Sambrani Diego Javier Zea Felix Cremer Fredrik Ekre Gautam Mishra Iagoba Apellaniz Ian Butterworth Immortalin Jeremiah Jonas Jonker János Veres Leo Logan Kilpatrick Marius Millea Matt Helm Musab Kılıç Philip D Loewen Robert Moss Rémi Vezy Satoshi Terasaki Sebastian Stabinger Sergey Konoplich Chebro Syx Pek Tobias Skarhed Troels Arnfred Bojesen Utkarsh Shah zuckberj Vlad Zhixing Wang Zlatan Vasović contradict disberd elliotsayes gregod heetbeet holomorphism romaindegivry Ömür Özkir

👀 Reading hidden code
170 ms











👀 Reading hidden code
8.6 μs
👀 Reading hidden code
4.1 ms
podcast = html"<iframe src='https://omny.fm/shows/future-of-coding/37-de-nerding-programming-jonathan-edwards/embed' width='100%' height='150' frameborder='0'></iframe>";
👀 Reading hidden code
25.9 μs











👀 Reading hidden code
25.0 μs
2
1 + 1
👀 Reading hidden code
10.8 μs
Error message

Multiple definitions for hello

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

hello = 123
👀 Reading hidden code
---











👀 Reading hidden code
9.7 μs

Programming is too difficult!




👀 Reading hidden code
4.9 ms

"(...) those of us who are good at abstraction are the ones that flourish in programming, yet, even we don't have the power enough to pull it off. We're constantly failing and making mistakes and unable to comprehend what it is that we've just done."

Jonathan Edwards, Future of Coding #37

👀 Reading hidden code
46.8 ms

"If we could only just minimize this intense intellectual burden of programming, then regular people would be able to do it, but we'd also be able to do more."

Jonathan Edwards, Future of Coding #37

👀 Reading hidden code
245 μs
👀 Reading hidden code
530 μs

Visual programming?

👀 Reading hidden code
189 μs

Scratch

LabVIEW

image

👀 Reading hidden code
195 ms

How to get the column sums of a matrix:

👀 Reading hidden code
247 μs

Assembly

main:
        push    rbp
        mov     rbp, rsp
        push    rbx
        sub     rsp, 104
        lea     rax, [rbp-80]
        mov     rdi, rax
        call    std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::vector() [complete object constructor]
        mov     QWORD PTR [rbp-48], 2
        mov     QWORD PTR [rbp-56], 2
        mov     rdx, QWORD PTR [rbp-48]
        lea     rax, [rbp-80]
        mov     rsi, rdx
        mov     rdi, rax
        call    std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::resize(unsigned long)
        lea     rax, [rbp-112]
        mov     rdi, rax
        call    std::vector<int, std::allocator<int> >::vector() [complete object constructor]
        mov     rdx, QWORD PTR [rbp-56]
        lea     rax, [rbp-112]
        mov     rsi, rdx
        mov     rdi, rax
        call    std::vector<int, std::allocator<int> >::resize(unsigned long)
        mov     QWORD PTR [rbp-24], 0
        jmp     .L12
.L15:
        mov     DWORD PTR [rbp-28], 0
        mov     QWORD PTR [rbp-40], 0
        jmp     .L13
.L14:
        mov     rdx, QWORD PTR [rbp-40]
        lea     rax, [rbp-80]
        mov     rsi, rdx
        mov     rdi, rax
        call    std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::operator[](unsigned long)
        mov     rdx, rax
        mov     rax, QWORD PTR [rbp-24]
        mov     rsi, rax
        mov     rdi, rdx
        call    std::vector<int, std::allocator<int> >::operator[](unsigned long)
        mov     eax, DWORD PTR [rax]
        add     DWORD PTR [rbp-28], eax
        add     QWORD PTR [rbp-40], 1
.L13:
        mov     rax, QWORD PTR [rbp-40]
        cmp     rax, QWORD PTR [rbp-48]
        jb      .L14
        mov     ebx, DWORD PTR [rbp-28]
        mov     rdx, QWORD PTR [rbp-24]
        lea     rax, [rbp-112]
        mov     rsi, rdx
        mov     rdi, rax
        call    std::vector<int, std::allocator<int> >::operator[](unsigned long)
        mov     DWORD PTR [rax], ebx
        add     QWORD PTR [rbp-24], 1
.L12:
        mov     rax, QWORD PTR [rbp-24]
        cmp     rax, QWORD PTR [rbp-56]
        jb      .L15
        lea     rax, [rbp-112]
        mov     rdi, rax
        call    std::vector<int, std::allocator<int> >::~vector() [complete object destructor]
        lea     rax, [rbp-80]
        mov     rdi, rax
        call    std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::~vector() [complete object destructor]
        mov     eax, 0
        jmp     .L21
        mov     rbx, rax
        lea     rax, [rbp-112]
        mov     rdi, rax
        call    std::vector<int, std::allocator<int> >::~vector() [complete object destructor]
        jmp     .L18
        mov     rbx, rax
.L18:
        lea     rax, [rbp-80]
        mov     rdi, rax
        call    std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::~vector() [complete object destructor]
        mov     rax, rbx
        mov     rdi, rax
        call    _Unwind_Resume
.L21:
        mov     rbx, QWORD PTR [rbp-8]
        leave
        ret
.LC0:
        .string "vector::_M_default_append"

__static_initialization_and_destruction_0(int, int):
        push    rbp
        mov     rbp, rsp
        sub     rsp, 16
        mov     DWORD PTR [rbp-4], edi
        mov     DWORD PTR [rbp-8], esi
        cmp     DWORD PTR [rbp-4], 1
        jne     .L245
        cmp     DWORD PTR [rbp-8], 65535
        jne     .L245
        mov     edi, OFFSET FLAT:_ZStL8__ioinit
        call    std::ios_base::Init::Init() [complete object constructor]
        mov     edx, OFFSET FLAT:__dso_handle
        mov     esi, OFFSET FLAT:_ZStL8__ioinit
        mov     edi, OFFSET FLAT:_ZNSt8ios_base4InitD1Ev
        call    __cxa_atexit
.L245:
        nop
        leave
        ret
_GLOBAL__sub_I_main:
        push    rbp
        mov     rbp, rsp
        mov     esi, 65535
        mov     edi, 1
        call    __static_initialization_and_destruction_0(int, int)
        pop     rbp
        ret

👉

C++

vector <int> result;
result.resize(cols);
for(size_t j = 0; j < cols; ++j)
{
	int sum = 0;
	for(size_t i = 0; i < rows; ++i)
	{
		sum += A[i][j];
	}
	result[j] = sum;
}

👉

Julia

sum(A; dims=1)
👀 Reading hidden code
47.6 ms











👀 Reading hidden code
11.4 μs
👀 Reading hidden code
20.8 μs
👀 Reading hidden code
69.9 μs
👀 Reading hidden code
29.2 μs
👀 Reading hidden code
66.5 μs
Error message

UndefVarError: miniplot not defined

Stack trace

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

  1. eval
  2. seval
  3. onestep_light(e::Expr; m::Module)
  4. onestep_light(e::Expr; m::Module)
  5. macro expansion
  6. Show more...
Probably not your fault!
@visual_debug begin
(1+2) + (7-6)
miniplot(2000 .+ 30 .* rand(2+2))
4+5
sqrt(sqrt(sqrt(5)))
md"# Wow"
end
👀 Reading hidden code
---
👀 Reading hidden code
67.2 μs

Used in PlutoTest.jl:

👀 Reading hidden code
204 μs
sqrt(12 + 12) > 3 sqrt(
24
) > 3
4.898979485566356
> 3
true
@test sqrt(12 + 12) > 3
👀 Reading hidden code
340 ms
5 ∈ filter(iseven, [x ^ 2 for x = 1:6]) 5 ∈ filter(
iseven (generic function with 5 methods)
, [x ^ 2 for x = 1:6])
5 ∈ filter(
iseven (generic function with 5 methods)
,
)
5 ∈
false
@test 5 ∈ filter(iseven, [x^2 for x in 1:6])
👀 Reading hidden code
125 ms
Error message

Multiple definitions for hello

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

uhmmmmmm??!
@bind hello Slider(1:10)
👀 Reading hidden code
---
Error message

Another cell defining hello contains errors.

hello
👀 Reading hidden code
---
Error message

UndefVarError: left not defined

Stack trace

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

  1. from :0
  2. eval
  3. seval
  4. onestep_light(e::Expr; m::Module)
  5. macro expansion
  6. Show more...
Silly computer!
@test left == right
👀 Reading hidden code
---











👀 Reading hidden code
9.5 μs

Code and LaTeX

👀 Reading hidden code
184 μs
f(x)=xR1++xf(x) = \oint_{ x \in \mathbb{R} } \frac{ 1 + ⠀ }{ ⠁ + x }
👀 Reading hidden code
243 ms
5
z
👀 Reading hidden code
80 ns
f(x)=xR1++xf(x) = \oint_{ x \in \mathbb{R} } \frac{ 1 + ⠀ }{ ⠁ + x }
👀 Reading hidden code
92.0 ms
👀 Reading hidden code
66.9 μs
Error message

UndefVarError: tex_example not defined

Stack trace

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

  1. from :0
  2. eval
  3. seval
  4. onestep_light(e::Expr; m::Module)
  5. macro expansion
  6. Show more...
Everything is going to be okay!
@visual_debug begin
tex_example
miniplot(2000 .+ 30 .* rand(2+2))
4+5
sqrt(sqrt(sqrt(5)))
md"# Wow"
end
👀 Reading hidden code
---











👀 Reading hidden code
8.5 μs

Widgets and code

👀 Reading hidden code
187 μs
using PlutoUI
👀 Reading hidden code
217 ms
@bind hi TextField(default="asdfasdfasdf")
👀 Reading hidden code
154 ms
"asdfasdfasdf"
hi
👀 Reading hidden code
9.7 μs

👀 Reading hidden code
10.2 μs
@bind howdy TextField2(default="asdfasdfasdfasdf")
👀 Reading hidden code
44.6 ms
missing
howdy
👀 Reading hidden code
10.3 μs
👀 Reading hidden code
67.9 μs
👀 Reading hidden code
137 μs
TextField2 (generic function with 1 method)
👀 Reading hidden code
501 ms











👀 Reading hidden code
17.3 μs

Visual and textual programming?

👀 Reading hidden code
247 μs
2×2 Matrix{Int64}:
 95  44
 40  21
x = [
@widget(slider(95)) @widget(slider(44))
@widget(slider(40)) @widget(slider(21))
]
👀 Reading hidden code
32.3 μs
2×2 Matrix{Int64}:
 95  44
 40  21
x
👀 Reading hidden code
10.0 μs











👀 Reading hidden code
11.3 μs











👀 Reading hidden code
9.0 μs
plot([1,4,5];
linewidth = @widget(slider(16)),
legend = @widget(checkbox(false)),
)
👀 Reading hidden code
2.4 s
@widget(slider(28)), @widget(checkbox(true))
👀 Reading hidden code
19.2 μs
@widget (macro with 1 method)
👀 Reading hidden code
418 μs
slider (generic function with 1 method)
👀 Reading hidden code
375 μs
checkbox (generic function with 1 method)
👀 Reading hidden code
349 μs
stackrows (generic function with 1 method)
👀 Reading hidden code
433 μs
Div
👀 Reading hidden code
12.7 ms
outline (generic function with 1 method)
👀 Reading hidden code
484 μs
function height(p)
	c1 * sqrt(p * c2)
end

to

function height(p)
	c1 * log(p * c2)
end
👀 Reading hidden code
13.6 ms
flex (generic function with 1 method)
👀 Reading hidden code
1.8 ms
flex (generic function with 2 methods)
👀 Reading hidden code
2.1 ms
grid (generic function with 1 method)
👀 Reading hidden code
1.8 ms
aside (generic function with 1 method)
👀 Reading hidden code
553 μs
👀 Reading hidden code
256 μs
👀 Reading hidden code
227 μs
👀 Reading hidden code
4.2 s
👀 Reading hidden code
39.7 ms
👀 Reading hidden code
172 μs
miniplot (generic function with 1 method)
👀 Reading hidden code
1.4 ms
👀 Reading hidden code
4.2 ms
tex (generic function with 2 methods)
👀 Reading hidden code
16.0 ms
👀 Reading hidden code
30.6 μs











👀 Reading hidden code
10.1 μs











👀 Reading hidden code
9.3 μs