Fork me on GitHub
#specter
<
2019-12-18
>
roklenarcic14:12:25

hm here;’s a question, let’s say you have a predicate that will, given 2 values (key and value) tell you if you need to remove this map entry, how would you transform a map to drop those entries

roklenarcic14:12:50

I tried `

[(collect-one MAP-KEYS) MAP-VALS]

roklenarcic14:12:18

but that doesn’t work since collect-one’s select must return a single value

nathanmarz21:12:49

@roklenarcic the pattern for that is (setval [ALL (fn [[k v]] ...)] NONE my-map)

roklenarcic22:12:14

so any function can act as predicate in path? What’s the difference between that and using pred

nathanmarz22:12:49

a function in a path implicitly uses pred

nathanmarz22:12:07

you can use pred manually for something like (pred :a)

nathanmarz22:12:39

:a by itself would navigate to :a, whereas (pred :a) would filter based on the value of :a