specter

Latest version: 1.1.3
roklenarcic 2019-12-18T14:08:25.001200Z

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

roklenarcic 2019-12-18T14:08:50.001500Z

I tried `

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

roklenarcic 2019-12-18T14:09:18.002100Z

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

nathanmarz 2019-12-18T21:51:49.003Z

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

roklenarcic 2019-12-18T22:01:14.003900Z

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

nathanmarz 2019-12-18T22:03:49.004300Z

a function in a path implicitly uses pred

nathanmarz 2019-12-18T22:04:07.004700Z

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

nathanmarz 2019-12-18T22:04:39.005300Z

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

roklenarcic 2019-12-18T23:34:15.005500Z

ok thank you