Fork me on GitHub
#specter
<
2017-04-23
>
sophiago07:04:23

@nathanmarz after seeing your excellent presentation this past week at the NYC Clojure meetup, I think specter could likely greatly help me in working with the output of a library I have that produces deeply nested maps of vectors. Mainly my issue is that built-in functions don't seem to go deep-enough into the nesting and rolling my own with walking has proven two difficult with all the filtering necessary. I'm using integer keys, which means I should probably switch to the int-map library for efficiency, but that doesn't seem like it would solve any of my major problems.

sophiago07:04:57

I'm currently mainly concerned with the following: 1. I'd like to stick with generating the data into an unsorted map for speed, but when I use (into (sorted-map) ...) after the fact it oddly doesn't sort the deepest level of nesting. 2. Searching for values within the maps using some similarly always returns nil as it doesn't seem to be searching deep enough. 3. Same when it comes to using filter to eliminate empty vectors. 4. Same when trying to use vals to eliminate keys entirely.

sophiago07:04:09

Although I can see how navigators like MAP-VALS and NIL->VECTOR would help with this, I'm having trouble figuring out from the API docs how to compose them to achieve these results. I know this is quite a bit, but any pointers on which functions/macros to look at would be greatly appreciated. Thanks!

nathanmarz12:04:21

@sophiago going to be easiest to help you by working through some specific examples

nathanmarz12:04:11

which navigators you need to compose for a use case depends entirely on the use case, a huge portion of specter's core navigators could be relevant for what you've described so far