8 ms·
The advertisement promises a combination of bash and lisp. So it makes me wonder -- why couldn't we just use lisp? What are the affordances needed for a "scrip
by ssivark 2y ago
The advertisement promises a combination of bash and lisp. So it makes me wonder -- why couldn't we just use lisp?
What are the affordances needed for a "scripting" language (or for interactive use) vis-a-vis more "production use? Is it just about having minimal boilerplate, and a large corpus of ready-to-use functions in the namespace?
- Kinrany 2y agoProcess composition is one thing that shell languages do better than traditional programming languages
- hnlmorg 2y agoThere’s plenty of LISP packages that support process composition. Also LISPs syntax better suits write once type environments like REPL shells than your average C-derived syntax.
- Kinrany 2y agoAny examples? Searching for this is hard. What would `foo | bar | baz` look like in a lisp?
- christophilus 2y agoSomething like Clojure’s threading macro, probably: (-> (foo) (bar) (baz))
- slowmovintarget 2y agohttps://github.com/babashka/babashka https://github.com/babashka/babashka Granted, if you're saying why can't we have the shell also... well, now you're talking about Emacs.
- jimbokun 2y agoMaybe the ultimate would be default to bash but if you start a command with a prefix everything following is parsed and evaluated as an s-expression.
- toolslive 2y agoipython is the complete opposite: python but enhanced with bash. For example: x = !ls # capture the output of `ls` into x x[0] # the first filename ...
- jerf 2y ago"Is it just about having minimal boilerplate" That's a lot of it, but I think people don't realize how every keystroke counts with shell. There's only a handful of languages where the "apply function" operator is space. Shell is one of them. (Haskell & Forth are the other two I know off the top of my head, possibly Factor (concatenative in general tends this way).) Most new shells that are successful copy this. I don't think that's a coincidence. Lisp's abundance of parens is something that people will have trouble with, even Lisp programmers, because this is not the usual whining about a foreign language paradigm and not being used to reading parens... this is literally about the effort required to physically enter them with a keyboard.
- tom_ 2y agoRegarding minimal syntax: https://yosefk.com/blog/i-cant-believe-im-praising-tcl.html https://yosefk.com/blog/i-cant-believe-im-praising-tcl.html
- jerf 2y agoYeah, it really is like that. I've tried a couple of times to switch to things like IPython as my shell. And what nukes it every time is that while it may be better at the complicated commands I run maybe 1% of the time if you actually look at an unmodified history, cd("some dir") is just too much insanely harder than cd som TAB ENTER and I'm just smashing that TAB in a tight interactive loop to figure out how little I need to type. It doesn't look like it when you're doing it once, but when you're doing it dozens of times a minute it adds up fast.
- solidsnack9000 2y agoIn addition to "space is function application" another important shell affordance seems to be "words are just words" -- you don't have to quote simple strings like `README.md`. If you want a single string with more than one word (where there is a space in between), that is in conflict with "space is function application", so then you have to put it in quotes.