This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-31
Channels
- # aleph (1)
- # announcements (2)
- # beginners (105)
- # braveandtrue (1)
- # cider (61)
- # clara (47)
- # cljdoc (29)
- # cljs-dev (5)
- # clojure (61)
- # clojure-austin (14)
- # clojure-brasil (1)
- # clojure-india (3)
- # clojure-italy (4)
- # clojure-mexico (1)
- # clojure-nl (2)
- # clojure-spec (37)
- # clojure-uk (95)
- # clojurescript (73)
- # cursive (12)
- # data-science (1)
- # datomic (26)
- # duct (10)
- # emacs (5)
- # fulcro (47)
- # hoplon (6)
- # hyperfiddle (3)
- # jobs-discuss (3)
- # kaocha (2)
- # leiningen (3)
- # nrepl (8)
- # off-topic (3)
- # onyx (2)
- # re-frame (31)
- # reitit (16)
- # shadow-cljs (36)
- # spacemacs (46)
- # specter (16)
- # tools-deps (13)
- # yada (22)
Hey @nathanmarz, in a few of your blog posts you mention using specter for some pretty interesting graph stuff. I was interested in making specialized navigators for https://jsonapi.org/ and thought some examples of defining navigators for "specialized" domains might be helpful. Do you have any more information / examples about your graph implementation?
IDK if ur familiar with the spec but the most kludgey thing it requires me to do is to hold onto the top level document, or some kind of id -> entity index, while I'm navigating through the tree structure w/ specter
I'm handling that by attaching metadata onto the things I'm navigating into, but like I said, its a little kludgy
@npetryk my graph navigators are specifically for dag's
TOPSORT
is like ALL
but visits nodes in topological order
Wow. This looks to be exactly what I will be needing in rewriting a DAG transformer! Specter is awesome! 💯
REVERSE-TOPSORT
is the same but opposite order
CHILDREN
goes from node to all children
likewise PARENTS
, DESCENDANTS
NODE
goes from a pointer to a node (which the aforementioned ones navigate you to) to the value for that node
node-nav
navigates to a specific node
and then a couple navigators for navigating to sub-dag's, with metadata and ids on nodes used to determine how to attach the transformed sub-dag into the parent dag
there's a few more but those are the main ones
for navigating a tree you probably don't need custom navigator implementations, just a few composite navigators using recursive-path
if you have some examples I can walk you through it
Thanks! https://github.com/nathanmarz/specter/issues/241 also gave me some insight. It looks like that instead of passing [graph node-id]
around I can just pass my tree "context" as metadata on individual nodes. The bit about reducing in the transform is also helpful for when I need to make updates to my tree
Wow. This looks to be exactly what I will be needing in rewriting a DAG transformer! Specter is awesome! 💯