Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active December 3, 2015 09:22
Show Gist options
  • Save mfikes/a0e0d0e831c106836bcb to your computer and use it in GitHub Desktop.
Save mfikes/a0e0d0e831c106836bcb to your computer and use it in GitHub Desktop.
How to use Planck Socket REPL

Socket REPL support for Planck has now landed in master. You can homebrew a copy of master via

brew remove planck
brew install --HEAD planck

When you launch Planck, pass the -n argument specifying a port or IP:port combination

planck -n 5555

For example, planck -n 5555 results in Planck starting up a REPL, as usual, and you can use it like you normally would.

$ planck -n 5555
Planck socket REPL listening.
cljs.user=> 4
4
cljs.user=> (+ 5 6)
11

But in this mode it will now listen for connections on port 5555.

$ rlwrap telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
cljs.user=> (map inc (range 5))
(1 2 3 4 5)
cljs.user=> 

You can make as many additional network sessions as you'd like. You can additionally use :repl/quit to get out of any of these network sessions.

These sessions all share the same underlying environment (analysis data, JavaScriptCore state, etc).

A consequence is that namespaces and defs created in one session can be seen in all others.

@wildthink
Copy link

Try out
rlwrap nc localhost 5555
to get command line editing, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment