Light Table and interactive live coding

April 25, 2014

LightTable 0.6.2 has been released recently. It now supports Python and graphics can be embedded directly into the interactive console.

LightTable changed a lot since it was first announced on Chris Granger website, especially regarding the core UI. It now features a plugin manager and inline evaluation, including graphical displays from IPython.

Since I was recently talking about Racket Scheme and its capabilities to display inline graphics, much like Emacs Geiser does, I believe I should just finish this post that I started more than a month ago.1 Here is a basic example with code from Matplotlib demo gallery (right):

LightTable is pretty fast and reactive, and it offers an interesting model for live coding session.2 And, well, it’s now open source. Maybe it could be a good alternative to IPython Qt console or even HTML notebook one day.

It’s quite interesting that Emacs, and to some extent Vim, comes with full-featured inferior modes and REPLs for most common languages, while Sublime Text (ST) and its sublimeREPL package offers far less powerful functionalities, although it has long been hailed as the definitive text editor. Personally, I can never remember more than 10 keyboard shortcuts–and I experienced the same frustration with Textmate before, which is why I still prefer Emacs over other editors: I can just type M-x followed by some keywords (ido takes care of the rest) and I get things done in few seconds. There is also a menu bar, which can be convenient at times (yes, I know, we don’t really need a mouse, but I use my trackpad :). Finally, there is a package manager which facilitates the installation/updating of additional packages.

However, it is interesting to note that we can interact with a live Racket shell in ST as well. Here is a screenshot of sublimeREPL running under ST3 with the same sample Scheme code as before: (The Racket package should be installed prior to running the Racket REPL, and racket must be in your $PATH.)


However, to be fair it looks like the R REPL has been enhanced. Last time I checked, their REPL was displaying strange characters when R expressions were being sent to it (this was last year with ST2 since SublimeREPL was not available for ST3). Now it looks ok, although I haven’t gone far with it:


Note that diving into litterate programming with knitr requires a couple of additional packages, namely SublimeKnitr, EnhancedR, and LaTeXing, but see Using knitr with LaTeXing for more information.

As a side note, although I recommend to my students to use RStudio when working with R, I think ST really is a good editor and this is what I would recommend to them in place of Emacs whose learning curve is certainly steeper.

  1. This post is pretty old, and LighTable is now at version 0.6.5. ↩︎

  2. Session provides yet another “Live-Coding Environment for Clojure”. ↩︎

See Also

» Textmate 2 » Alternative mail reader for Mac OS X » Visualizing results from SQL queries » User-friendly statistical packages » Sublime Text