I've longed for a language that can run both pipelines of commands with the conciseness of UNIX shells and have control structures and arithmetic as elegantly as Python...
Not to get off on too much of a tangent, but you may be interested in concatenative programming languages. They’re a variety of stack-based programming languages with a functional flavour, in which the default style is a sort of data pipeline. For example, in Factor[1]:
! Just some imports.
USING: accessors smtp ;
! Create a new email object.
<email>
! That object is piped implicitly to these setter words.
! E.g., >>from: ( email new-address -- email )
"alice@example.com" >>from
{ "bob@example.com" } >>to
"Coffee?" >>subject
"You pick the time and place." >>body
! Pipe that object on to the “send-email” word.
send-email
Note how no local variables are necessary for simply plumbing data around—although of course you can use them if you want.
The weirdest thing is probably that arithmetic in most concatenative languages is written in postfix, which you may find off-putting. But it’s no worse than Lisp’s prefix notation, and has some other benefits.
Factor also has an excellent interactive environment; the whole thing feels like a Lispy Smalltalk.
Prefix/postfix/infix refer to the order in which you write operations and their operands—equivalently you can think of preorder/postorder/inorder traversals of the syntax tree.
AST +
/ \
* 5
/ \
2 3
Infix 2 * 3 + 5
2 times 3 plus 5.
Prefix + * 2 3 5
Lisp (+ (* 2 3) 5)
The sum of the product of 2 and 3, and 5.
Postfix 2 3 * 5 +
With 2 and 3, multiply. Then with 5, add.
You can do this with Tcl ! I wrote an extension called "pipethread" to make UNIX shell pipelining more natural. It uses threads instead of processes but otherwise operates pretty similarly.
Example: set lsOutput [pipethread::pipe exec ls | exec tac | foreach line { puts $outchan "[string length $line]:$line" } | { gets $inchan line; puts $outchan $line }]
TCL works nice as a shell and is very elegant as a programming language. The famous equivalence of code and data is visible here, while still syntactically looking pretty normal.
Scheme (via https://scsh.net/about/about.html) is also worth looking into. S-exp based syntax looks strange at first, but you get used to it rather quickly.
Emacs Eshell is very similar to xonsh, but with Emacs Lisp instead of Python.
On Windows PowerShell is also a choice. It's both a shell and a sane, procedural programming language, with full access to dotNET.
On the other hand, jq (https://stedolan.github.io/jq/) is just a DSL, but it turns out it's ok for doing more advanced work if you're familiar with functional programming.
Not to mention, almost every language with a REPL can be made into a shell/programming environment given enough library support. For example Python with IPython is a very decent shell and I think OCaml with utop could also be.
The weirdest thing is probably that arithmetic in most concatenative languages is written in postfix, which you may find off-putting. But it’s no worse than Lisp’s prefix notation, and has some other benefits.
Factor also has an excellent interactive environment; the whole thing feels like a Lispy Smalltalk.
[1]: http://factorcode.org/