Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure REPL readline like support

Tags:

clojure

Several REPLs (like ruby's irb) have some very useful features, such as using the arrow keys to "rewind" and "forward" the command history; but when I try to do the same with Clojure, it only prints garbage (I suspect it prints the keycode). How can I get this feature in the Clojure REPL?

like image 327
Mangano Avatar asked Sep 21 '10 19:09

Mangano


2 Answers

You need to use JLine or rlwrap. Refer to http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_the_Environment for assistance

like image 66
ponzao Avatar answered Sep 25 '22 20:09

ponzao


Download jline from here and copy the jar to the directory from where the clojure.jar is loaded. The clj script should find and enable it.

On the other hand if you use leiningen to organize your projects, which I heartily recommned, then you do not have to do anything other than run lein repl and the REPL starts with the expected history behavior and all dependencies of your project on the classpath.

like image 36
Peter Tillemans Avatar answered Sep 25 '22 20:09

Peter Tillemans