Fork me on GitHub
#specter
<
2017-04-10
>
deplect15:04:12

I have a question, supose I want to delete all keys-values pairs in the :exposure map with spectre. How would I go about?

deplect15:04:14

{:mdc-artificial/random {5 {:exposure {1000 {[1.0 2.0] 200.0}}} 10 {:exposure {2000 {[1.0 2.0] 400.0}}}}}

deplect15:04:05

where all key-values i want to delete must be smaller than 1500 🙂

nathanmarz16:04:33

@deplect you mean empty all exposure maps where the sum of the numbers within is < 1500?

nathanmarz16:04:40

that would just be:

(transform [:mdc-artificial/random MAP-VALS
            :exposure
            (selected? (traversed (walker number?) +) #(< % 1500))]
  empty
  data)

deplect16:04:02

hai Nathan, no I already figured it out …

deplect16:04:25

i want exactly the 1000 key in the exposure map to be gone.

deplect16:04:53

came down to: (sp/transform [MAP-VALS MAP-VALS MAP-VALS] #(remove-keys (partial > expire-time) %) registry)

nathanmarz16:04:33

in that case I think you want something more along the lines of:

(setval [:mdc-artificial/random
            MAP-VALS
            :exposure
            MAP-KEYS
            #(< % 1500)]
  NONE
  data)

deplect16:04:31

yes buy :mdc-artificial/random can be any value. :exposure will always be called exporsure

nathanmarz16:04:08

easy to modify to handle that

deplect16:04:04

yes works like a charm, the transform version fails under certain circumstances, thx!