Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 1.33 KB

README.md

File metadata and controls

58 lines (42 loc) · 1.33 KB

An nREPL client that reads Clojure code from standard input and writes the result to standard output.

Installation

Dependency

You need to install https://github.com/nrepl/nrepl

Binary release

Fetch a binary from https://github.com/mkmik/gonrepl/releases/latest

Source install

go install github.com/mkmik/gonrepl@latest

Usage

Leiningen has built-in support for nREPL since version 2. You can start a nREPL session with:

$ lein new app acmedemo
$ cd acmedemo
$ lein repl
nREPL server started on port 54344 on host 127.0.0.1 - nrepl://127.0.0.1:54344
REPL-y 0.5.1, nREPL 0.8.3
Clojure 1.10.3
OpenJDK 64-Bit Server VM 18.0.1+0
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

acmedemo.core=>

gonrepl talks to nREPL at the localhost:$LEIN_REPL_PORT address by default. Pass the -a flag to override the default address.

In another terminal you do:

$ export LEIN_REPL_PORT=54344
$ echo '(+ 1 2)' | gonrepl
3
$ echo '(println "foo")' | gonrepl
foo
nil

Related projects

  • acmeclj uses gonrepl to execute clojure expressions from the editor.