TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Lisp Shell

120 pointsby dexterlaganabout 7 years ago

11 comments

tonygabout 7 years ago
You might be interested in an experiment of mine, <a href="https:&#x2F;&#x2F;github.com&#x2F;tonyg&#x2F;racket-something&#x2F;blob&#x2F;master&#x2F;src&#x2F;something&#x2F;shell.rkt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tonyg&#x2F;racket-something&#x2F;blob&#x2F;master&#x2F;src&#x2F;so...</a>, which combines an indentation-based reader with a handler for unbound variables to permit fluid interoperation between Racket procedures and external programs.<p>Here&#x27;s an example (<a href="https:&#x2F;&#x2F;github.com&#x2F;tonyg&#x2F;racket-something&#x2F;blob&#x2F;master&#x2F;examples&#x2F;sh.rkt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tonyg&#x2F;racket-something&#x2F;blob&#x2F;master&#x2F;exampl...</a>):<p><pre><code> #lang something&#x2F;shell &#x2F;&#x2F; Simple demos ls -la $HOME | grep &quot;^d&quot; | fgrep -v &quot;.&quot; ls -la | wc -l | read-line |&gt; string-split |&gt; car |&gt; string-&gt;number |&gt; \ printf &quot;There are ~a lines here.&quot; | sed -e &quot;s: are : seem to be :&quot; (newline) def ps-output pipeline ps -wwwax preserve-header 1 {: grep &quot;racket&quot; } space-separated-columns [string-&gt;number] |&gt; csv-expr-&gt;table print ps-output def message-box text: whiptail --title &quot;Testing&quot; --ok-button &quot;OK&quot; --msgbox text 8 50 message-box &quot;This is pretty cool.&quot; </code></pre> `ls`, `grep`, `whiptail` and so on are unbound Racket variables, and the macros forming part of the `something&#x2F;shell` dialect replace them with calls to the external programs, sorting out the plumbing, pipes and so on. `read-line`, `car`, `string-split`, etc are ordinary Racket functions from the standard libraries.<p>(EDIT): Here&#x27;s a screencast of an interactive session with the shell. Very simple, but shows some of the basics: <a href="https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;83450" rel="nofollow">https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;83450</a>
评论 #16889952 未加载
评论 #16881619 未加载
hawkiceabout 7 years ago
Fun Unix Trivia Time: Touch is supposed to update modified times. That it creates files when they don&#x27;t exist is only the most common use, not the point of the thing.
评论 #16879325 未加载
评论 #16882258 未加载
评论 #16881572 未加载
评论 #16879277 未加载
lysiumabout 7 years ago
This reminds me of my time working with the Scheme Shell scsh!<p>From the readme I don’t quite understand the purpose of lsh, though. Usually, a shell allows you to run programs and manipulate their environment. However, lsh seems to reimplement some commands like find or rm and does not provide operators to manipulate the runtime environment like redirecting output. Maybe you can write in the readme your goal: play with racket, have a shell that accepts racket forms or something different.
HerrMonnezzaabout 7 years ago
It would be nice to see some examples of the syntax, maybe a couple of simple scripts...<p>E.g., the README states that &#x27;cd&#x2F;&#x27; is an alias for &#x27;(cd &quot;&#x2F;&quot;)&#x27; which seems to imply that one has to wrap every command in &#x27;()&#x27; and quote every filename... not very practical for a shell!
评论 #16879488 未加载
评论 #16884977 未加载
preekabout 7 years ago
For the Emacs users, there&#x27;s eshell - a Shell, implemented in Elisp with the common GNU tooling, but also with the option to hook into regular elisp functions. Pretty cool stuff!
评论 #16879979 未加载
评论 #16881587 未加载
评论 #16881065 未加载
jlaroccoabout 7 years ago
I really like seeing more people use Lisp, and it&#x27;s neat to see what other people come up with, but I&#x27;ll stick with Emacs, Slime and occasionally eshell.<p>More often than not it&#x27;s easiest to just use the Common Lisp functions for creating directories and interacting with the system, but when that doesn&#x27;t work, I have a function similar to this one in my .sbclrc file:<p>(defun run (cmd) (with-output-to-string (outs) (uiop:run-program cmd :output outs)))<p>At work, I&#x27;ve even created a small Common Lisp library for calling our JSON APIs over HTTPS and running commands on our test clusters using SSH. It&#x27;s all tightly integrated into Emacs, and I can use it do things like open remote files in my local Emacs.
aetherlordabout 7 years ago
RASH, RAcket SHell library and language: <a href="https:&#x2F;&#x2F;github.com&#x2F;willghatch&#x2F;racket-rash" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;willghatch&#x2F;racket-rash</a><p>Note: I am not the author
评论 #16879539 未加载
评论 #16880023 未加载
sam-sabout 7 years ago
CLASH: CLisp As SHell <a href="http:&#x2F;&#x2F;clisp.org&#x2F;clash.html" rel="nofollow">http:&#x2F;&#x2F;clisp.org&#x2F;clash.html</a>
评论 #16879949 未加载
评论 #16879248 未加载
评论 #16882872 未加载
millettjonabout 7 years ago
See also clojure shell <a href="https:&#x2F;&#x2F;github.com&#x2F;dundalek&#x2F;closh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dundalek&#x2F;closh</a>
gigatexalabout 7 years ago
Interesting but one nitpick: always, always, always, in the github readme.md put an example of use so I can see what it’s like before installing.
评论 #16883812 未加载
评论 #16882871 未加载
nerdponxabout 7 years ago
As long as the top-level commands don&#x27;t have to be manually wrapped in (), I like this idea.
评论 #16879341 未加载