Fork me on GitHub
#announcements
<
2021-03-20
>
Adam Helins13:03:49

Slight update to Void, a CLJC library for handling nil (especially with collections): https://github.com/helins/void.cljc

👍 12
3
3
Vincent Cantin08:03:41

(= (void/assoc {:a 42}
                :a nil
                :b 42)
   {:a 42
    :b 42})
this is surprising, I would expect {:b 42} instead, in a way consistent with your update function.

metasoarous18:03:47

I had the same thought @U8MJBRSR5; Seems inconsistent with respect to whether nil clears out a k/v pair or just doesn't update.

Adam Helins14:03:31

Indeed, assoc is a no-op in case of nil. What you describe is its sibling, assoc-strict, which does that :) I guess it should be better examplified in the README.