clojure

kulminaator 2026-06-27T09:41:24.568669Z

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".

2026-06-27T14:49:22.331519Z

what do you mean by io exactly? is a real workhorse that feels pretty natural

valtteri 2026-06-27T18:31:22.054929Z

slurp and spit 😎

💯 1
borkdude 2026-06-27T18:32:27.409459Z

if you're looking for file system operations: https://github.com/babashka/fs

kulminaator 2026-06-27T19:53:00.875979Z

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.

Diana Helena 2026-06-29T14:30:06.570429Z

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)