This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-10
Channels
- # aleph (4)
- # beginners (32)
- # cider (12)
- # cljs-dev (56)
- # cljsrn (7)
- # clojars (3)
- # clojure (165)
- # clojure-dev (33)
- # clojure-germany (1)
- # clojure-italy (27)
- # clojure-russia (7)
- # clojure-spec (24)
- # clojure-uk (62)
- # clojurescript (37)
- # core-async (7)
- # core-matrix (1)
- # cursive (9)
- # data-science (8)
- # datomic (8)
- # duct (4)
- # events (1)
- # figwheel (7)
- # flambo (3)
- # fulcro (43)
- # hoplon (25)
- # jobs-discuss (8)
- # lein-figwheel (4)
- # luminus (2)
- # off-topic (35)
- # om (8)
- # om-next (3)
- # onyx (30)
- # pedestal (62)
- # portkey (2)
- # protorepl (2)
- # re-frame (40)
- # reagent (9)
- # shadow-cljs (123)
- # specter (30)
- # sql (22)
- # testing (1)
- # uncomplicate (40)
- # unrepl (3)
- # vim (13)
- # yada (5)
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)
@nathanmarz like this? https://github.com/gdeer81/specter-koans/blob/55686414f70c8ba739c84bafffb88173b7ee9f9d/src/koans/01_selection.clj#L50
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
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
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