Comment by ssivark

Comment by ssivark 2 days ago

11 replies

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?

jerf 2 days 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_ a day ago
    • jerf 18 hours ago

      Yeah, 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 a day ago

In 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.

Kinrany 2 days ago

Process composition is one thing that shell languages do better than traditional programming languages

  • hnlmorg 2 days ago

    There’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 a day ago

      Any examples? Searching for this is hard.

      What would `foo | bar | baz` look like in a lisp?

      • christophilus a day ago

        Something like Clojure’s threading macro, probably:

        (-> (foo) (bar) (baz))

jimbokun 2 days ago

Maybe 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 2 days ago

    ipython 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  
        ...