Show HN: Interactive Common Lisp: An Enhanced REPL
97 points
3 days ago
| 3 comments
| github.com
| HN
I created this because sometimes I want more than rlwrap but less than emacs. icl aims to hit that middle sweet spot.

It's a terminal application with context-aware auto-complete, an interactive object inspector, auto-indentation, syntax colouring, persistent history, and much more. It uses sly to communicate with the child lisp process and aims to be compatible with any sly-supporting implementation. I hope others find it useful!

dcassett
1 day ago
[-]
Perhaps because I'm still on Debian 12 (or more likely I did something wrong), I had trouble getting it working by compiling the icl/ocicl sources with sbcl. It complained "Failed to connect to Slynk after 10 seconds". I tried running a Slynk server in sbcl, but icl froze up, and the server said "slynk:close-connection: end of file on #<dynamic-extent STRING-INPUT-STREAM (unavailable) from "#A">. Then I tried running a swank server, and got the icl prompt (good), but then tab completion invoked the debugger: "Package SLYNK does not exist". Finally, I ran the swank server after first running "(asdf:load-system :slynk)" and everything seems to work.

One thing I immediately miss (that rlwrap provides) are the keyboard functions such as reverse-search-history (usually mapped to C-r) and history-search-backward (have this mapped to M-p). History recall only seems possible with the up arrow.

Also, be in for some surprises if you try to paste some lisp code into the REPL, especially if there are long lines. The interaction is apparently meant for a human typing, not pasting.

reply
atgreen
1 day ago
[-]
I fixed the paste issue. Thanks! (edit: And Ctrl-R)
reply
vindarel
23 hours ago
[-]
Differences I see with cl-repl (https://github.com/lisp-maintainers/cl-repl):

- icl doesn't have an interactive debugger, you ask for the backtrace with ,bt. cl-repl has one (less feature complete than Slime). I actually like the lack of a debugger for newcomers.

- icl: does auto-indentation right

- cl-repl: has an %edit command to launch an editor and load the file content on close.

- icl: better, prettier autocompletion with a drop-down. cl-repl is based on readline.

- icl: based on Slime's backend, so you can connect to another running image.

- cl-repl: has a ! shortcut to execute a shell command.

- cl-repl might be faster to launch.

big thanks to atgreen for all the nice projects!

reply
atgreen
23 hours ago
[-]
Thanks, vinderal. Since you wrote this the other day, I've improved the auto-completion so it is more context-aware. For instance, it will auto-complete using your filesystem when it is reasonably sure that you are trying to reference a filename. There's also a new interactive object inspector TUI, and a super-experimental `,explain` command. `,explain` will fire up gemini/claude cli to have it explain the last command/result/error. It provides temporary access to an icl mcp service so the AI can use tools for read-only access to your running lisp image.
reply
vjust
1 day ago
[-]
awesome, I will try it
reply