Fork me on GitHub
#specter
<
2017-10-10
>
gdeer8103:10:14

parinfer is a blessing and a curse

gdeer8104:10:06

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

gdeer8115:10:16

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"

nathanmarz15:10:13

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

nathanmarz15:10:53

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

nathanmarz15:10:15

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

gdeer8116:10:07

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

gdeer8116:10:02

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

nathanmarz16:10:01

ah yea, that's good

nathanmarz16:10:40

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

gdeer8116:10:16

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

gdeer8116:10:04

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

gdeer8116:10:11

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

nathanmarz16:10:44

I would start simple before getting to anything too compound

gdeer8116:10:25

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

nathanmarz16:10:45

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

gdeer8116:10:45

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

gdeer8116:10:15

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

gdeer8119:10:01

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

gdeer8120:10:53

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

nathanmarz21:10:53

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

nathanmarz21:10:03

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

gdeer8122:10:11

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

gdeer8122:10:32

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

gdeer8122:10:44

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

gdeer8122:10:41

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

michaelwfogleman23:10:53

@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

nathanmarz23:10:18

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

nathanmarz23:10:56

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