Clojure REPL (11/06/2020)

Languages > Clojure

Last results

The 3 last results can be accessed using ‘*1’, ‘*2’, ‘*3’:

user=> (+ 3 4)
user=> (+ 10 *1)
user=> (+ *1 *2)


Clojure has a special namespace that can be used in REPL. To load it:

user=> (require '[clojure.repl :refer :all])

It includes some useful functions:

user=> (doc +)            ;Display the doc of the given function.
user=> (apropos "+")      ;Retrieve the doc about functions that match the given string.
user=> (find-doc "trim")  ;Search the given string in all docstrings.
user=> (dir clojure.repl) ;List the functions of the given namespace.
user=> (source dir)       ;Display the source code of the given function.

Something to say ?

Leave a Reply

Your email address will not be published.