Fork me on GitHub
Adam Helins13:03:49

Slight update to Void, a CLJC library for handling nil (especially with collections):

👍 12
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.


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.