Live data from Hacker News

A Lisp REPL as my main shell

ambrevar.xyz

21–30 of 31 posts

Re: A Lisp REPL as my main shell

#21

I don't get lisp. Actually I think I understand what people like about it. What I mean is that I don't know exactly how to "think in lisp". Is it like writing the AST instead of the text or describing what is needed instead of what needs to be done... I simply don't get it. Not sure if I'm the only one though.

Take any idea of a data pipeline, something like with rabbit or kafka. Now describe that in functions by composition.

read-data -> push-to-rabbit -> read-from-rabbit -> send-ack -> push-to-http.

Turns out with functional composition + data structures you can do a lot.

With the idea of immutability or persistent data structure with say Clojure, a lot of idea start to make sense. Rich Hickey videos are pretty good at describing simpler programs. Even if you never use Clojure, or Lisp, or Scheme, these idea might make you a better programmer. At least they did for me. My Python code is now much simpler because I realized I didn't need everything I was doing.

Re: A Lisp REPL as my main shell

#22
post #2

It’s interesting to note that while no single idea is revolutionary, the design choices in putting together this bunch make for a particularly slick interface where the whole is much better than the usual shell. PS: I look forward to trying this out! Since I don’t know much Common Lisp, are there particularly useful libraries that would make it easy to cover functionality commonly used through the shell? I’d love to…

UIOP and Alexandria are very common. The former has a lot of functionality that you would normally expect out of a shell.

Re: A Lisp REPL as my main shell

#23
post #6

While not as extreme as what is demonstrated here, I integrate things in my environment with Lisp in a way that is similar to this. I run StumpWM too so I can grab the content of the current X selection and do actions from it (e.g. the content matches a JIRA ticket regex, open it, the text matches a filename, edit it (fun fact, anything can be a filename), etc.). For processes, I wrote something that is not finished,…

Hey please write a readme, your project is worth it!

Re: A Lisp REPL as my main shell

#24
post #2

It’s interesting to note that while no single idea is revolutionary, the design choices in putting together this bunch make for a particularly slick interface where the whole is much better than the usual shell. PS: I look forward to trying this out! Since I don’t know much Common Lisp, are there particularly useful libraries that would make it easy to cover functionality commonly used through the shell? I’d love to…

The article presents a few libraries. There is https://github.com/ruricolist/cmd in particular which is very helpful.

I'm going to publish a few more libraries which should help with file manipulation (as I demoed it).

Stay tuned!

Re: A Lisp REPL as my main shell

#25
post #12

>Terminals have no reason to continue to be used in my opinion. Note that this does not mean we shouldn’t use “textual” interfaces, quite the opposite: textual data is a bliss to manipulate. But we can very well manipulate text, along with other types of data, in something other than a terminal, that is faster, prettier, more powerful. (Graphical Emacs is one such example.) I have recently switched to Jupyter's qtcon…

Agreed, I think Jupyter got many things right, in particular when it comes to prompt handler and data visualization.

What I find limiting for now is interactions with the shell process, in my case the Common Lisp compiler: no interactive stacktrace, no debugger, etc. This is very limiting. I don't know if there is a way around it, as this could be a limitation of the Jupyter design with its kernels. Please let me know if there is a way out! :)

Re: A Lisp REPL as my main shell

#26

I wonder what people think about Ammonite ( https://ammonite.io/ )? It's not Lisp but Scala so may not be the authors language of choice however it can be used as a Shell: https://ammonite.io/#Ammonite-Shell I am personally using it and compared to a classical shell like Bash it's really nice for more structured data related tasks (exploring some API, checking some data, creating a bunch of PRs at once, ...). It also…

I've never tested Ammonite, only read the https://ammonite.io/#Ammonite-Shell, so I'm only guessing here.

From what I understand, Ammonite was designed as a "readline shell" as I wrote in the article. It perpetuates this approach that everything is a command.

The thesis of my article suggests we do the opposite: I'm suggesting to rethink shells by starting from the interface (here the SLY REPL) and then implement the shell features.

In particular, it seems that Ammonite does not support back-references and I'm not sure it has an interactive inspector.

While Ammonite seems to be a definite improvement over the _syntax_ of Bash, etc., I'm not sure it brings much novelty in terms of user interface. But again, I know very little about it so I may have missed some features :)

Re: A Lisp REPL as my main shell

#27
post #6

While not as extreme as what is demonstrated here, I integrate things in my environment with Lisp in a way that is similar to this. I run StumpWM too so I can grab the content of the current X selection and do actions from it (e.g. the content matches a JIRA ticket regex, open it, the text matches a filename, edit it (fun fact, anything can be a filename), etc.). For processes, I wrote something that is not finished,…

Wow, looks like you've got a lot of cool stuff in there! I'll try it out later and give you some feedback!

Re: A Lisp REPL as my main shell

#28

A very well done article! I wonder what an integration with a Python REPL might look like.

Xonsh is a fully featured Python shell with shell syntax added. https://xon.sh/

(To reiterate what I answered for Ammonite, s/Ammonite/Xonsh:)

I've only scratched the surface of Xonsh, so please correct me if I'm wrong.

From what I understand, Xonsh was designed as a "readline shell" as I wrote in the article. It perpetuates this approach that everything is a command.

The thesis of my article suggests we do the opposite: I'm suggesting to rethink shells by starting from the interface (here the SLY REPL) and then implement the shell features. In particular, it seems that Xonsh does not support back-references and I'm not sure it has an interactive inspector (or does Emacs python mode provide one?).

While Xonsh seems to be a definite improvement over the syntax of Bash, etc., I'm not sure it brings much novelty in terms of user interface. But again, I know very little about it so I may have missed some features, in particular regarding the Emacs integration :)

Re: A Lisp REPL as my main shell

#29
post #8

Back at uni I ran an experimental lisp shell. A few notes of what was painful and what worked. Outer most parens should be optional, if you're running ls you don't want to type (ls). Grouping flags, files and options is difficult: ls -lh file could become (ls (h l) file) (ls (flags h l) (files file)) (ls -l -h file) (ls -lh file) none of the options are particularly good or lispy. You need a full editor on the comman…

I believe I answered most of your notes in the article ;)

Re: A Lisp REPL as my main shell

#30

Earlier quoted context omitted.

Can you switch mode once the executable's already been launched, though? It's already got its tty, so you'd presumably need to start up the ncurses-capable terminal on demand, switch it in, and play back any meaningful prior output so it's in sync. The page is dead so I can't see how they handle it, but each of those steps is potentially problematic, isn't it?

> Can you switch mode once the executable's already been launched, though? Yes, apps can change terminal mode at any time. The solution the author went with is to have a list of "visual program" names, and when a visual program name is detected, launch it in an external terminal (xterm or Emacs vterm). That is making no attempt to handle mode switches during program execution, it is making a permanent decision before…

Thanks for the suggestion.

The "widget" you are talking about seems to required some specific support from the host REPL, no? Could SLY do it? Could graphical Emacs do it?

Post reply on HN