specter

Latest version: 1.1.3
theeternalpulse 2019-05-06T04:02:57.003700Z

If I am doing a transform with multi/path how can I refer to the las tthing selected before that path for example

(multi-transform [LAST
                    (multi-path [:a (terminal #_something-here-to-reference-LAST-object)]
                                [:b (terminal dec)])]
                   [1 2 3 4 5 {:a 1 :b 5 :c nil}])

theeternalpulse 2019-05-06T04:03:29.004400Z

how can In the terminal statement can I say "give me the LAST from the previous selector before I started branching off"

theeternalpulse 2019-05-06T04:13:06.005Z

do I have ot just have a path that is like [(terminal #(update % :a some-fn (:c %)...)

theeternalpulse 2019-05-06T04:15:51.005400Z

(multi-transform [LAST
                    (multi-path [(terminal #(update % :a + (:b %)))]
                                [:b (terminal dec)]
                                [:c (terminal-val 123)])]
                   [1 2 3 4 5 {:a 1 :b 5 :c nil}])
seems to work but wonder if there's a more specter way of doing that

nathanmarz 2019-05-06T13:19:56.006200Z

@theeternalpulse use one of the value collection navs, like collect or collect-one

theeternalpulse 2019-05-06T14:22:08.006800Z

Ah I see, now that makes the subsequent multipath fns have to take two arguments

theeternalpulse 2019-05-06T15:02:35.007600Z

no I tried it, nice solution, need to read through these again,

(multi-transform [LAST
                    (multi-path
                     [(collect-one :b) :a (terminal +)]
                     [:b (terminal dec)]
                     [:c (terminal-val 123)])]
                   [1 2 3 4 5 {:a 1 :b 5 :c nil}])