The newest "learning" deftest has just been pushed: https://github.com/kennytilton/matrix/blob/main/cljc/matrix/test/tiltontec/learn/b020_async_integrity.clj
I will add a simple exercise later or tomorrow. Then come lazy cells of various kinds, and then a hasty check to see if laziness got ported to CLJD. Backstory here is I only implemented laziness to answer some complaints about eagerness. đ But then came a day when it proved handy, loading from Postgres only as needed, so it's all good.
We violate the general testing rule and actually hit the interweb to execute an XHR against the the FDA Adverse Events service, then pipe the response asynchronously into the Matrix.
Moral: callback heaven, by leveraging the Matrix raison d'etre, elegant state change handling.
Interestingly, the artificial nature of testing required a deep dive into Matrix state change handling, and a new macro with-async-change to make sure async changes are properly handled as "top level".
Questions/comments welcome.
Just added an exercise to b020-async-integrity: https://github.com/kennytilton/matrix/blob/4319530a7c1c110a6f8207394ee79655170ecd2f/cljc/matrix/test/tiltontec/learn/b020_async_integrity.clj#L62 Not too bad if one swipes code cleverly from the other test. đŠč
ps. Just remembered I have not yet touched on dependencies between multiple MX instances, a huge feature.
Lazy can wait, methinks. Examples are here anyway: https://github.com/kennytilton/matrix/blob/main/cljc/matrix/test/tiltontec/cell/lazy_cells_test.cljc
Next up: MX "families", simple trees where MX instances have a parent slot :par and zero or more children in the :kids slot.
:par is required for any child (ie, all but the root MX instance); must be supplied at make time; and cannot be changed. It is never a cell.
:kids is always a formulaic cell. Note that mxWeb and f/mx wrappers use clever macrology so we never actually have to code the :par or :kids properties.
Back to Inter MX dependencies: a suite of utilities make it easy for one MX to track down another MX to consult its properties in cell formulas. Cycles are detected at run time and throw an exception. We could soften this, just need a use case.
"Cycles are detected at run time"
Yeah, but not on searching the Matrix. Cycles detected are on derivation chains. It is fine for one instance to find itself using fget, the "family search" utility. Indeed, when I search from node X, by default X gets checked first to see if it matches the search criteria. This happens if node Y cares about, say, a the nearest radio group manager. As the DOM gets juggled during iterative development, Y might end up as the radio group manager! np!