|
|
|
|
|
by cljacoby
848 days ago
|
|
I also use cat this way, and for me the biggest reason is it just allows for a more intuitive left-to-right reading of any pipeline. Things like this: head -n 500 access.log | grep ... head -n 500 <access.log | grep ... Feel like you start with the filename, then go leftwards to the first operation, then start reading rightward again through the pipe. At least in my brain, it feels slightly more awkward. |
|
It's funny, when learning programming, I think Haskell was the language that introduced me to the pattern of having a chain of operators processing a stream to build up a result (and I'd later cover it again in SICP), and I loved how clean it looked compared to imperative code. But I now find it one of the harder to read languages due to it all being prefix, whereas Java/Kotlin/C#/Javascript now all have stream constructs that use method calls, so read left-to-right, source-to-sink
And I'm reminded that I need to give Forth a proper go sometime
[1] https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax