%load_ext juliamagic
%julia 1+2+3
6
%julia 1+2+3.0
6.0
%%julia
sum([1 2;3 4]^2)
54
%%julia
sum([1 2;3 4.0]^2)
54.0
For some reason, multiline blocks aren't executing quite right, so for now I'm putting them line by line. Need to investigate further. But even function definitions work:
%julia fib(n) = n < 2 ? n : fib(n-1) + fib(n-2)
%julia fib(10)
55
And once defined, they can be used as the state of the Julia interpreter is persistent:
%%julia
fib(20)
6765