vvvvalvalval / supdate

Clojure's update with superpowers.
https://vvvvalvalval.github.io/supdate/
MIT License
204 stars 4 forks source link

added deps.edn, support for 'false' to denote wildcard key for maps #6

Closed drcode closed 5 years ago

drcode commented 5 years ago

Since 'supdate' has already established the idea of "false" as a magical value (for key dissoc) it seem like an obvious extension to accept "false" as a magic value for map keys as well- In that case, the obvious operation is to treat it as a wildcard key value, mapping updates against all vals in the map, which is a frequently needed ability:

(supdate {:a 5 :b 10} {false inc}) => {:a 6 :b 11}

Also:

  1. This is a matter of "taste" so I won't be offended if you don't like this idea.
  2. There may be ways to better optimize the compile-time handling for this, I couldn't figure out an obvious way to do it that made sense to me.