7
votes

I would like a command-line (must be a command line!) read-eval-print-loop Scheme interpreter. But spefically, I'd like an interpreter than can at least highlight parentheses, and maybe even keep a history like GNU readline-enabled programs. All of this at REPL-level.

Does this exist? Is it even possible? Do I have to hack this into some open-source REPL? Am I just bad at computer? Should I even bother?

I've checked other questions for this but I haven't quite found what I'm looking for. I've tried Racket and mzscheme, but it doesn't seem to do what I want. For now I'm using mit-scheme, but that balancing feature (much like whatever program they used in the SICP lectures) would be pretty much all I could ever want from it.

1
Pro-tip for using any REPL (not just Scheme REPLs) is a little utility called rlwrap. You should be able to install it on most *nix systems. Call it like rlwrap scheme and it will wrap input to the REPL with readline, giving you history, nicer editing, etc... Invaluable if the REPL is really basic like Clojure's. I don't think this is specifically answering your need, so I didn't make it an answer, but it might be useful in general. Also, I think you can start most Schemes as inferior-lisps in Emacs, which give you much more, but I won't go so far as to push that :)michiakig
@spacemanaki: Does rlwrap support vi editing mode? That's one thing I <3 about readline (and libedit).Chris Jester-Young
Good question -- I don't know. A quick search turns up some likely results, but I wouldn't be a good person to test it out, I haven't used readline's vi-mode in a long time, so I couldn't tell you if it's comparable.michiakig

1 Answers

8
votes

Both Racket (with readline support loaded; see below) and Chez Scheme will do this. :-) So will Guile, but it will fold multi-line forms into a single line (unlike Racket/Chez).


To enable bracket matching for Racket, add this line to your ~/.racketrc:

(#%require readline/rep)

and this line to your ~/.inputrc:

set blink-matching-paren on