Fork me on GitHub

parinfer is a blessing and a curse


latest version of the koans are up with all unparameterized and parameterized navigators covered


next step is covering the rest of the core macros in depth. I had a real chicken and egg problem when deciding how to organize the koans. it's like do I say "look at select [ALL] ignore what ALL means, but here's what select returns vs select-one or do I say look what [ALL] does, it does something different if used with select setval and transform but just know that no matter what you're doing, it gives you all the things"


@gdeer81 in my mind I find the easiest mental model is distinguishing between subvalue, substructure, filter, and view navigators


subvalue navs I just imagine as taking me to subvalues of a data structure, and the operation (e.g. select, transform) just says what to do when I get there


one example that would be good for the koans to illustrate what an operation does is (select-any ALL data)


After watching @james screencast I think you're right, the first thing that needs to be discussed is the concept of subvalues, substructures, filters, and views


in koan 1 I kept running into it when illustrating navigation but never made it a first class concept


ah yea, that's good


a series with select-any, select-first, select-one, and select-one! to show the subtle differences would be good too


Yeah, I think I can flesh out the rest of koan 1 to operate on the same data structure, the trick is finding one that's complex enough to be interesting but not so unwieldy that it ruins the learning experience


I've started mining github for examples by searching for repos where people have hand-written map-vals


another one people seem to grok easily is product data. even ones with complex hierarchies


I would start simple before getting to anything too compound


okay, I'll save it for the advanced koans then


if you want to make "challenge koans" towards the end, paths that require subselect are usually pretty challenging


yeah, when I did the parameterized navigators koan and I got to subselect, I just copied and pasted the example from the wiki


it hurt my brain trying to think of a practical example that would work


after playing with subselect a bit I'm starting to get it. basically for transforms you want to use a function that takes a collection and returns a collection. a lot of these seem tricky in isolation but once you start understanding when you would use them, they become more intuitive


my next endeavor is using specter with reframe. most reframe events have pretty small effects like "add this string to the todos vector" but someone once said that you don't need to have a deeply nested data structure to get the benefits of specter. so if anything I will get to play around with visualizing specter transformations with refrisk


@gdeer81 a visualizer of navigation would be a tremendous addition to the project


I think that would really help people get over the learning curve


awesome I was able to get reframe events and subscriptions to use specter but refrisk doesn't show enough detail to visualize the transformation. Back to the drawing board


I am pretty happy I got specter working with re-frame, even though I'm doing anything mind blowing (reg-sub :counter (fn [db _] (specter/select-any [:counter] db))) gets the current count of the counter and (reg-event-db :inc-counter (fn [db _] (specter/transform [:counter] inc db)) increases the counter this is wired up to a div subscribed to the count and a button to dispatch the :inc-counter event


and of course the db is just {counter 0} but I wanted to get it working before I went too crazy with the nesting


tonight I'll explore the re-frame library that gives you undo capabilities since that will probably keep track of before/after app db state which would be helpful with the visualization


@nathanmarz Venturing into the code with an initial commit of a regex navigator - I just have select working - might need an assist with the transform implementation


@michaelwfogleman a regex can match many substrings, so your implementation doesn't look right


I'm not sure what replacement facilities are available in the regex api