Fork me on GitHub
#specter
<
2016-06-12
>
codonnell00:06:58

@nathanmarz: ok, so it's a more general version of pathed functions like srange and filterer

codonnell00:06:03

thanks for the response

codonnell00:06:07

the example was very helpful

nathanmarz02:06:09

@codonnell: It's a generalization of filterer but not of srange

nathanmarz02:06:39

filterer is defined as (subselect ALL (selected? path))

nathanmarz02:06:25

the expected transformed sequence for subselect is expected to remain the same size, with each index referring to a particular location in the original structure

nathanmarz02:06:48

the transformed sequence for srange can be of any size and will splice back into the original sequence to replace the original subsequence

codonnell02:06:29

@nathanmarz: that makes sense.

codonnell02:06:03

@nathanmarz: I put up my notes and examples as a github wiki page at https://github.com/codonnell/specter/wiki/List-of-Navigators. It could serve as a starting point for navigator reference documentation; you're welcome to copy any of it that you'd like.

aengelberg05:06:32

I like your wiki page because every navigator has a few examples. I'm hoping Specter's official docs will be like that eventually.

nathanmarz13:06:56

@codonnell: That's great, I'd like to get that merged into the official docs at some point

nathanmarz13:06:25

I made some modifications for things that were implementation details and not promised to have that exact behavior in future versions

nathanmarz13:06:03

For example, in many parts it said "returns a lazy sequence when used in a select", and that behavior is already completely different in 0.12.0

nathanmarz13:06:44

As for params-reset, that's used to make a recursive path that requires parameters

nathanmarz13:06:12

by wrapping the recursive call in params-reset, it tells the recursive navigation to use the same parameters

nathanmarz13:06:56

e.g.

(declarepath MyWalker [k])
(providepath MyWalker
  (stay-then-continue must (params-reset MyWalker)))

(select (MyWalker :a) {:a {:a {:b 2}}})
;; => [{:a {:a {:b 2}}} {:a {:b 2}} {:b 2}]

rauh14:06:00

I like it, but PLEASE don't introduce anymore breaking changes

rauh14:06:29

It's such a pain, I can't currently upgrade and I'm stuck with an older version since the breaking macros changes.

nathanmarz15:06:56

@rauh breaking changes are only done when they are necessary to enable very significant improvements

nathanmarz15:06:47

what's preventing you from upgrading and making the appropriate updates?

rauh15:06:16

@nathanmarz: I can't upgrade since midje pulls in an older specter

nathanmarz15:06:56

@rauh yea, that's unfortunate

rauh15:06:48

Not the end of the world, but specter is getting to the point (1100 gh stars, 57k clojar pulls) that it should be careful if the breaking changes are needed.

nathanmarz15:06:24

like I said, I only make breaking changes when the benefits are very significant

rauh15:06:25

I agree that the macros was a change that was worth it.

nathanmarz15:06:44

0.12.0 will have another breaking change, but it only affects projects that define their own navigators

rauh15:06:42

Well I blame suchwow (used by midje) more for that since they use specter twice! (Two simple transform)

nathanmarz15:06:18

Ah, well the 0.12.0 change only affects the select path

luxbock15:06:26

my actual use case is slightly more complicated

nathanmarz15:06:20

(let [foo-map {:foo #{1 2 3} :bar #{5 6}}]
  (transform [ALL
              (collect-one FIRST (view #(get foo-map %)))
              LAST
              ALL
              ]
    (fn [aset v]
      (if (aset v)
        (str v)
        (inc v)
        ))
    {:foo [1 2 4 5]
     :bar [2 3 5 6]}
    ))

luxbock15:06:45

@nathanmarz: nice, I'll have to get familiar with view`

codonnell16:06:44

Thanks for removing the implementation detail.

codonnell16:06:12

Is there a reason params-reset takes a single path argument rather than a varargs like most of the other pathed functions?

nathanmarz16:06:10

@codonnell: It's only intended for the particular use case of recursive parameterized navigators

nathanmarz16:06:53

your description for params-reset is a little inaccurate – it actually decrements position in params array by the number of parameters that navigator requires

nathanmarz16:06:07

where that's important is a path like [must MyWalker]

nathanmarz16:06:23

will merge in and fix description

codonnell16:06:34

The new description makes perfect sense.

nathanmarz16:06:29

By the way, really appreciate the documentation contribution – that's Specter's biggest problem at the moment

codonnell16:06:39

You're most welcome.

codonnell16:06:38

@nathanmarz: I just realized every all-caps link and link with a > in it was broken. It's fixed on my wiki. (Oops)

conaw16:06:29

Also, discovered the map-vals bug earlier wasn’t a bug, just my own insufficient cleaning of compiled javascript when updating specter versions.

nathanmarz16:06:02

@conaw: cool, good to know