Fork me on GitHub
#specter
<
2016-07-31
>
luxbock13:07:15

I'd like to use MAP-VALS but ignore one specific key in the passed in map

luxbock13:07:20

how would I do this?

Chris O’Donnell14:07:48

@luxbock: If you don't need to rebuild, you could do (view #(dissoc % :key))

Chris O’Donnell14:07:22

You could also define your own navigator to do it, which shouldn't be too hard

luxbock14:07:39

I do need the key present in the returned result

luxbock14:07:04

Yeah I was wondering if there had been an easy way to do it with the builtins

luxbock14:07:47

I think rather than building a navigator for this specific use case I would rather just wrap the whole thing with dissoc and assoc

Chris O’Donnell14:07:29

(transform [ALL #(not= :a (first %)) LAST] inc {:a 0 :b 1 :c 2})

Chris O’Donnell14:07:56

@luxbock: definitely not as efficient as using assoc and dissoc, but it does work

luxbock15:07:45

Yeah, thanks, I think I'll end up doing it manually because this function gets called a ton