Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ disableKinds = ['taxonomy', 'term', 'rss', 'sitemap', '404']
name = "notebook"
kind = "kernel · command"
href = "https://github.com/go-notebook/notebook"
blurb = "The kernel, the <code>notebook</code> command (<code>run</code>, <code>html</code>, <code>watch</code>, <code>serve</code>, <code>irb</code>) and the HTML export: <code>format</code> parses the Markdown, <code>analysis</code> builds the dependency graph from the syntax, <code>gen</code> writes the Go program, <code>kernel</code> compiles and drives it through <code>runtime</code> and keeps results and values, <code>export</code> writes the page. <strong>Ruby cells</strong> (<code>```ruby</code>) run on <a href=\"https://github.com/go-embedded-ruby/ruby\">rbgo</a>, a Ruby written in Go, with the <a href=\"https://github.com/go-scikit/ruby\">go-scikit bindings</a> (<code>Stats</code>, <code>Special</code>, <code>Optimize</code>, <code>Integrate</code>, <code>DataFrame</code>, <code>Plot</code>, <code>NDArray</code>), and share their variables with the Go cells. <code>--timeout</code> and <code>--memory</code> stop a runaway cell in either language. <strong><code>notebook irb</code></strong> is the same Ruby as an interactive session, as irb: <code>=&gt; inspect</code> after each input, <code>_</code>, multi-line input decided by rbgo's parser, Tab completion and history in a pure-Go line editor (<a href=\"https://github.com/go-ruby-reline/reline\">go-ruby-reline</a>), each input in a worker that <code>--timeout</code>, <code>--memory</code> or Ctrl-C can stop without losing the prompt, and <code>--save</code> to keep the session as a notebook. <a href=\"/docs/main/irb/\">More →</a> <strong>Julia cells</strong> (<code>```julia</code>) are parsed with <a href=\"https://github.com/go-embedded-julia/julia\">go-embedded-julia</a>'s parser and checked (syntax errors at their line with julia's message, names in the dependency graph under Julia's scope rules), and, since go-notebook v0.18.0, run by its interpreter (v0.15.0) in one kernel shared by the Julia cells: a global or a function a cell defines is there in the next one, and a failure is julia's own text. The kernel boots from a prebuilt Base image, fetched on the first Julia cell and loaded only if its SHA-256 is the pinned one (cold start about a second). A cell may run 30 s and 50 million statements, within a memory budget of 512 MiB counted as 16 bytes per array element (a floor, not the heap: strings are not counted, and one array may have at most 2^24 elements). Julia variables stay in Julia, as R's do: they are not shared with Go, Ruby, R, C or Fortran cells in either direction yet. Known limitations: a loop at the top level of a cell cannot update a global (go-embedded-julia#54). The playground checks Julia cells and does not run them (<em>Julia cells run in go-notebook, not yet in the browser</em>). <a href=\"/docs/main/julia/\">More →</a> <strong>R cells</strong> (<code>```r</code>) are parsed with <a href=\"https://github.com/go-embedded-r/r\">go-embedded-r</a>'s parser, identical to R 4.6.2 on R's own sources, and checked in the same way: syntax errors at their line in R's words, names in the graph, and a cell that cannot be analysed from its text (<code>&lt;&lt;-</code>, <code>eval</code>, <code>library</code>) depending on every cell above it. They run on go-embedded-r's evaluator in one shared environment (v0.10.0), and since v0.12.0 each cell is bounded: 512 MiB of vectors, 50 million steps, 30 s. The browser playground runs them too (playground v0.15.0), in its second core, with R variables kept apart from the other languages: 512 MiB, 20 million steps, 10 s per cell, and a crash restarts the core with a message on the cell. <a href=\"/docs/main/r/\">More →</a> <strong>Fortran cells</strong> (<code>```fortran</code>) are checked and run with <a href=\"https://github.com/go-embedded-fortran/fortran\">go-embedded-fortran</a> (since go-notebook v0.17.0, go-embedded-fortran v0.17.0: its <code>sema</code> session for the names and errors, its <code>eval.Session</code> for the running; free form, implicit typing off) and highlighted with go-rouge's <code>fortran</code> lexer. The Fortran cells share one session: a cell sees the variables (with the values the earlier cells left), procedures, modules and derived types of the Fortran cells before it. Fortran variables stay in Fortran, as R's do: they are not shared with Go, Ruby, Julia, R or C cells in either direction yet. A cell may make at most 2^32 loop iterations and calls and run 30 s, and a failure is reported at its line and column. The browser playground runs them too (playground v0.16.0), in its second core, with Fortran variables kept apart from the other languages: 200 million steps and 10 s per cell, and an endless <code>do</code> ends with a message and leaves the page usable. <a href=\"/docs/main/fortran/\">More →</a>"
blurb = "The kernel, the <code>notebook</code> command (<code>run</code>, <code>html</code>, <code>watch</code>, <code>serve</code>, <code>irb</code>) and the HTML export: <code>format</code> parses the Markdown, <code>analysis</code> builds the dependency graph from the syntax, <code>gen</code> writes the Go program, <code>kernel</code> compiles and drives it through <code>runtime</code> and keeps results and values, <code>export</code> writes the page. <strong>Ruby cells</strong> (<code>```ruby</code>) run on <a href=\"https://github.com/go-embedded-ruby/ruby\">rbgo</a>, a Ruby written in Go, with the <a href=\"https://github.com/go-scikit/ruby\">go-scikit bindings</a> (<code>Stats</code>, <code>Special</code>, <code>Optimize</code>, <code>Integrate</code>, <code>DataFrame</code>, <code>Plot</code>, <code>NDArray</code>), and share their variables with the Go cells. <code>--timeout</code> and <code>--memory</code> stop a runaway cell in either language. <strong><code>notebook irb</code></strong> is the same Ruby as an interactive session, as irb: <code>=&gt; inspect</code> after each input, <code>_</code>, multi-line input decided by rbgo's parser, Tab completion and history in a pure-Go line editor (<a href=\"https://github.com/go-ruby-reline/reline\">go-ruby-reline</a>), each input in a worker that <code>--timeout</code>, <code>--memory</code> or Ctrl-C can stop without losing the prompt, and <code>--save</code> to keep the session as a notebook. <a href=\"/docs/main/irb/\">More →</a> <strong>Julia cells</strong> (<code>```julia</code>) are parsed with <a href=\"https://github.com/go-embedded-julia/julia\">go-embedded-julia</a>'s parser and checked (syntax errors at their line with julia's message, names in the dependency graph under Julia's scope rules), and, since go-notebook v0.18.0, run by its interpreter (v0.17.0, since go-notebook v0.19.0) in one kernel shared by the Julia cells: a global or a function a cell defines is there in the next one, a top-level loop updates a global as in IJulia (55 for a sum of 1 to 10), and a failure, a <code>MethodError</code> included, is julia's own text. The kernel boots from a prebuilt Base image, fetched on the first Julia cell and loaded only if its SHA-256 is the pinned one (cold start about a second). A cell may run 30 s and 50 million statements, within a memory budget of 512 MiB counted as 16 bytes per array element (a floor, not the heap: strings are not counted, and one array may have at most 2^24 elements). Julia variables cross with Go cells in both directions (Int64, Float64, Bool, String, and vectors and matrices of Float64 or Int64; Go <code>int</code> and <code>[]int</code> as Int64): a Julia value of another type stays in Julia and the Go reader is deferred, naming the type, and a Go value Julia cannot take fails the Julia cell. Inputs are measured before any copy (2^24 elements per array, a cell's inputs together within its memory limit, so a cell can hold up to twice its limit). This breaks v0.18.0, where Julia variables were not shared. Known limitations: a Float64 <code>A * x</code> needs BLAS (go-embedded-julia#67), a non-ASCII <code>uppercase</code> needs utf8proc (#65), and <code>Get</code> refuses an n×0 matrix (#76). The playground checks Julia cells and does not run them (<em>Julia cells run in go-notebook, not yet in the browser</em>). <a href=\"/docs/main/julia/\">More →</a> <strong>R cells</strong> (<code>```r</code>) are parsed with <a href=\"https://github.com/go-embedded-r/r\">go-embedded-r</a>'s parser, identical to R 4.6.2 on R's own sources, and checked in the same way: syntax errors at their line in R's words, names in the graph, and a cell that cannot be analysed from its text (<code>&lt;&lt;-</code>, <code>eval</code>, <code>library</code>) depending on every cell above it. They run on go-embedded-r's evaluator in one shared environment (v0.10.0), and since v0.12.0 each cell is bounded: 512 MiB of vectors, 50 million steps, 30 s. The browser playground runs them too (playground v0.15.0), in its second core, with R variables kept apart from the other languages: 512 MiB, 20 million steps, 10 s per cell, and a crash restarts the core with a message on the cell. <a href=\"/docs/main/r/\">More →</a> <strong>Fortran cells</strong> (<code>```fortran</code>) are checked and run with <a href=\"https://github.com/go-embedded-fortran/fortran\">go-embedded-fortran</a> (since go-notebook v0.17.0, go-embedded-fortran v0.17.0: its <code>sema</code> session for the names and errors, its <code>eval.Session</code> for the running; free form, implicit typing off) and highlighted with go-rouge's <code>fortran</code> lexer. The Fortran cells share one session: a cell sees the variables (with the values the earlier cells left), procedures, modules and derived types of the Fortran cells before it. Fortran variables stay in Fortran, as R's do: they are not shared with Go, Ruby, Julia, R or C cells in either direction yet. A cell may make at most 2^32 loop iterations and calls and run 30 s, and a failure is reported at its line and column. The browser playground runs them too (playground v0.16.0), in its second core, with Fortran variables kept apart from the other languages: 200 million steps and 10 s per cell, and an endless <code>do</code> ends with a message and leaves the page usable. <a href=\"/docs/main/fortran/\">More →</a>"
[[params.repos]]
name = "playground"
kind = "wasm · page"
Expand Down
2 changes: 1 addition & 1 deletion playground/notebooks/4-julia.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ xs = [i^2 for i in 1:3]
total = sum(xs)
```

Julia variables stay in Julia (they are not shared with Go cells, in either direction), so a cell of another language neither reads `total` nor waits for it. It runs as usual, whatever the Julia cells above it do:
In go-notebook itself, Julia variables cross to and from Go cells (Int64, Float64, Bool, String, and vectors and matrices of Float64 or Int64). Here the Julia cell is only checked, so a cell that reads no Julia name neither reads `total` nor waits for it. It runs as usual, whatever the Julia cells above it do:

```go
n * 2
Expand Down
Loading