4 ms·
Shell scripting with ideas from Elixir, chiefly, functional programming style would be profitable too. As an avowed (mostly) functional programmer, I do it FP s
by adityaathalye 3y ago
Shell scripting with ideas from Elixir, chiefly, functional programming style would be profitable too. As an avowed (mostly) functional programmer, I do it FP style [1].
Of course, one can take a Shell script only so far. Eventually a Real Programming Language is the inescapable (pun intended) conclusion. [Insert "Always was" meme].
[1] I wrote about it here.
https://www.evalapply.org/posts/shell-aint-a-bad-place-to-fp-part-2-functions-as-unix-tools/ https://www.evalapply.org/posts/shell-aint-a-bad-place-to-fp...
- bruh2 3y agoThat was so cool. Kind of an eye-opener. Bookmarked, thank you!
- adityaathalye 3y agoThank you for the kind remark. It so happened that I picked up shell scripting on the job at a workplace full of FP nerds. Pipelined code felt eerily familiar. Then at some point I read that Archmage McIlroy, a mathematician by training, invented the pipe. That was a lightbulb moment; a big reason why Functional style works as well as it does. Pipes are a mathematical idea. That whole series of posts is basically a glorified bookmark for yours truly. Tactics and tricks accumulated over the years. I refer back to bits and bobs from time to time. Writing them was a lot of, ah, fn.
- giovannibonetti 3y agoThis Bash library [1] is very handy to make your scripts more functional. [1] https://github.com/ssledz/bash-fun https://github.com/ssledz/bash-fun
- adityaathalye 3y agoI feel like I've seen this one before. Thanks for bubbling it back up in my brain. I think `map`, `filter`, and `reduce` (or `accumulate`) are automatic in pipelines; and have usually been enough for me. Still, it has a bunch of stuff one can pinch in a hurry. Starred!