Scsh did a lot of work with this but it’s still (as I recall) ungainly. Not to mention the idea of mixing process calls with native functions.
Something like this would be nice:
(| ‘ls’ (myfunc) ‘uniq’ (out-to “afile”))Scsh did a lot of work with this but it’s still (as I recall) ungainly. Not to mention the idea of mixing process calls with native functions.
Something like this would be nice:
(| ‘ls’ (myfunc) ‘uniq’ (out-to “afile”))This answer by Jörg W Mittag is very convincing:
https://stackoverflow.com/a/3640403/512904
This table in particular is very illuminating:
| Ruby | Bash
-----------------------------------------
number | 123 | 123
string | '123' | 123
regexp | /123/ | 123
file | File.open('123') | 123
file descriptor | IO.open('123') | 123
URI | URI.parse('123') | 123
command | `123` | 123
Here's a similar table with add your example's syntatic elements: | Lisp | Bash
-----------------------------------------
command | `ls` | ls
function | (myfunc) | myfunc
string | "afile" | afile
redirection | (out-to "afile") | >afileBut on the pragmatic side, if you want to interop with shell, or some other language/runtime, isn't it sometimes easier and less typing and noise if a program can be expressed in DSL or as a mix of Lisp and a DSL than if everything is written in pure s-expressions?
https://scsh.net/about/what.html
It certainly is much more convenient than Python for writing scripts that must execute other programs.
Many years ago, I have written quite a large amount of big scripts in scsh, and it was much easier to avoid bugs and to maintain them than in a traditional UNIX shell, without being so verbose as something like Python.
Unfortunately, nowadays scsh is quite ancient and it would need some serious work to bring it up-to-date, to be able to work without limitations on modern computers. It would probably be necessary to port it to a more recent Scheme interpreter than Scheme 48 (which is an old 32-bit program).