Inline Evaluation
Clojure
If you have some Clojure code in a file already, you can get going with inline eval by:
- Create a new file and save it with a
.clj
extension or open a.clj
file - Press Cmd/Ctrl+Enter to evaluate a form
- Wait for the client to connect (this can take a bit the first time)
- Once connected you'll see your result.
Javascript/HTML/CSS
In order to evaluate Javascript, HTML, or CSS, we need a browser to see the result in. To open a browser tab in Light Table:
- In the view menu click the
commands
item - Type "brows" and press enter when the
Browser: add browser tab
command is highlighted - Use the URL bar at the bottom to open your page. This can be a
file://
URL to open an HTML file locally, or it can be something on the network.
Now that we have a place to send our code, let's open a .js
file and eval something:
- Create a new file and save it with a
.js
extension or open a.js
file - Press Cmd/Ctrl+Enter while the cursor is over a top-level block of code. To eval an inner block, select and then eval it.
- Select the webpage name from the available clients popup
- You'll now see results inline!
- Evaling from a
.css
file will inject the CSS into the page. - Evaling from an
.html
file will refresh the browser tab.
Python
Getting started with Python is as simple as:
- Create a new file with a
.py
extension or open a.py
file - While over some code press Cmd/Ctrl+Enter
- Allow Light Table a few seconds while it connects to a python process
- You'll now see results inline!
If you want to use Light Table to do matplotlib/pylab graphs and such, you'll need to install the IPython kernel:
- Follow these instructions to install IPython (note: it must IPython 1.0 or greater and you must install pyzmq as well in order for it to work with Light Table.)
- Make sure IPython is on your path
- Restart Light Table
- Open a
.py
file by pressing Cmd/Ctrl+Shift+O - Over an expression that will return a graph, press Cmd/Ctrl+Enter
- You'll see the graph embedded below your expression.