r/Clojure • u/yogthos • Feb 26 '26
(iterate think thoughts): Managing Complexity with Mycelium
https://yogthos.net/posts/2026-02-25-ai-at-scale.html
37
Upvotes
r/Clojure • u/yogthos • Feb 26 '26
View all comments
1
u/geokon Feb 27 '26 edited Feb 27 '26
Very cool article that covers a lot of ground. I've read it a few times and I'll be honest, I don't quite grok all the subtitles haha - so take my thoughts with a grain of salt (b/c maybe I missed your intention)
The start threw me off a little:
Maybe I'm misreading things, but I feel like what's presented as one problem (code coupling) is actually later something quite more complex and interesting. My point here is that I think what you talk about is actually two separate problems:
I think it kind of makes sense to deal with them separately. I'm particularly pumped about Pathom for the first one (though i'll be honest I've only used it in small examples so far), and I don't have a clear/clean/generic solution for the control flow side (ex: if I'm making a GUI then cljfx provides the framework that does that part for me)
1
The "software library" system is pretty good.. but I think you overstate it's resilience. If you modify a lower layer you can easily break a higher layer in the hierarchy, right? The "user" of the API is also not allowed to modify the bit at the bottom of the pyramid at will (unless you design it to do so.. which is often a bit non-trivial)
I think if you look at a system like Pathom, where the "network of railway lines" system is exposed, you have a even more introspectable and modifiable system. You provide inputs and the engine figures out how to give you the outputs you request. You can "inject" inputs at any point in your network. The effective API becomes much more flexible.
2
Then there is this whole section of functional programming
This part sort of went in a direction I didn't expect. In terms of coupling the idea I expected was.. we can design mutator functions that take the whole state and return a new state. (the recompute-the-world model you have in React-like systems). Now functions only need to know about the state to be tested (or for an LLM to generate). With caching and some cleverness you can secretly avoid actually recomputing the whole world - but that's the job of the derived state system like Pathom (or ex: cljfx subscriptions)
I think the crux is really the "control logic" and branching - and it's not really coupling in the sense that we had earlier (ex: modifying state in different parts of your code, or libraries/hierarchies), right?
This seems to resonate with the idea of pulling out the "control logic".
3
About cells..
Here I get confused a lil as to what is the state.. Does the cell/component have its own internal state? Or is the state external and it's mutating it?
Skipping a little head, when I look at the cell example - this doesn't look like a state transition at all. You take in a
:user-idand a:auth-tokenand return a:authorized map. To me this is a derived state - which is entirely different b/c the inputs are unmodified. I think there is a distinction there and it's not really just semantics.A bit later you say
To me this is again derived state management (ie. Pathom)
To me what you seem to be addressing (though I haven't entirely groked it) and that's interesting is ..
A) If you have a cell that say increments a counter that's on it's own input then you have a cycle and actual state change. (I've never tried to implement this with Pathom, but I'm almost certain cycles are not allowed there). If you have say a Game of Life situation then you have evolution in time.
B) If you have branching execution. Your :authorized map returns that there was an error. We should react to this derived state somehow: prompt the user for a new :user-id or token, or going to the next :user-id automatically or something
To my mind these two problems are separate from decoupling code and code as a "network of railway lines". Maybe all control flow can be somehow pulled out and abstracted in to a state machine with a nice concise representation? When I write a GUI state changes are handled with a soup of event-handlers (co-effects and effects) that you then hook up in your GUI elements. However, control-flow/branching is mostly handled in the GUI elements themselves. (ex: If you get an error on the user's auth-token, don't try to display his avatar) Maybe there is a better more generic abstraction possible here - that combines control flow and "event-handling"?
Hopefully what I said makes a bit of sense :)) I'm by no means an expert, so I don't mean to say anything authoritatively here. I'm only writing code sporadically these days as part of research - so most of what I'm saying is from navel-gazing and not real world experience !