What has been the most clojure idiomatic way of approaching i/o that you have seen? I don't mean "hey this works with java's cumbersome api in some way". I mean what really feels and looks like "hey, this feels really natural for clojure as a language".
what do you mean by io exactly? is a real workhorse that feels pretty natural
slurp and spit 😎
if you're looking for file system operations: https://github.com/babashka/fs
i meant the style of handling input/output operations, like reading from a file or writing to a file ... slurp and spit are simple, but only for a specific scope, that doesn't scale well to immense files or network socket streams (let alone udp "streams") or i/o with a launched sub process from the operating system.
imho IO is intently procedural/imperative so my go-to approach in any functional setting is to have an imperative shell and a functional core
It works by push side effects as much as possible to the boundaries of the code (the imperative shell) and transforming/marshalling data across this boundary, this allow for idiomatic code in the functional core which is blissfully unaware of IO
Few concrete examples: in FRP sources and sinks are the shell, the rest is the core; in Haskell the interact function abstracts the shell; clojure transducers (https://clojure.org/reference/transducers explains this decoupling); etc
This approach is ubiquitous nowadays and almost all middleware/interceptor based web framework is doing this for the request IO (although usually handlers are still doing IO for database)