Command Line Interface (REPL) vs Notebook Interface

By Xah Lee. Date: . Last updated: .

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

A alternative environment is called a notebook. Used by for example, Mathematica , Matlab, MathCAD, Jupyter.

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.

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 Alt+x eval-last-sexp , or evaluate a block of lisp code Alt+x eval-region, or whole buffer's code Alt+x eval-buffer.

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

emacs racket mode 2015-10
emacs racket mode, and also interactive shell (2015-10). you can eval any code in buffer, like a notebook. The REPL lets you eval expression sequentially only. [see Racket: Using Emacs racket-mode]

due to emacs environment, you can also have notebook interface for languages other than lisp. For example org mode's babel feature, allows you to embed code of many programing languages and lets you eval any part of buffer just like lisp.

emacs org mode babel 2015-02-21
emacs org mode babel. It lets you embed, and eval any code anywhere in a buffer. [see Emacs: Org Mode, Programing Language Code Markup]

2016-12-08 originally a answer to reddit