tags:

views:

122

answers:

3

Hi

Several repl (like ruby irb) had some very useful features like use the arrows keys to "rewind" and "forward" the commands, but when i try to do the same with clojure, it only print garbage (I suspect it print the code of the key). How i could activate this feature in clojure?

+7  A: 

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

ponzao
+4  A: 

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.

Peter Tillemans
and if you are daring try cake as a leiningen competitor (uses same leiningen config files and a persistent jvm. its a lot less 'stable' than liningen
Arthur Ulfeldt
since version 1.3 leiningen has an interactive mode which keeps a single jvm and reduces startup time.
Peter Tillemans
+1  A: 

This depends on how you start your REPL. For example liebke's cljr has a nice REPL with readline support:

http://github.com/liebke/cljr

Michael Kohl