Shell, REPL, Notebook, and Emacs Environment Explained

By Xah Lee. Date: .

shell, or REPL, lets you type one command at a time. Then, you can revisit previous commands.

a alternative environment is called a notebook. For example, Mathematica, Matlab, MathCAD, use notebook interface.

in a notebook interface, you can evaluate one command at a time, as shell. But you can also jump around, evaluate any line of code, or block of code, in any order. All previouly evaluated commands are visible. You can delete them if you want.

And, the notebook itself acts as a form of presentation such as PDF or source code viewer, and also act as editor, and you can save the whole notebook.

many languages, started to have notebook interface. For example, clojure has a gorilla repl project, where the web browser is used as the notebook. Interactive Clojure Notebook: gorilla-repl

gorilla repl plot
Interactive Clojure Notebook: gorilla-repl

emacs, is like the notebook interface. Every buffer is a notebook, you can type some lisp code, evaluate it eval-last-sexp, or evaluate a block of lisp code eval-region, or whole buffer's code eval-buffer.

and emacs also allows you to have shell interface on top of the emacs environment, besides notebook. e.g. M-x shell for bash or windows exec, M-x ielm for elisp reple, and packages lets you do irc repl, clojure repl, scheme repl, etc.

dueo to emacs environment, you can also have notebook interface for languages other than emacs lisp. For example, there are packages for clojure, racket scheme, that lets you eval any part of buffer just like emacs lisp.


If you have a question, put $5 at patreon and message me.