Welcome! Please see the About page for a little more info on how this works.

+4 votes
in Clojure by

In CLJ-1894 I proposed a patch to change clojure.walk/stringify-keys to include namespace if keywords use namespaces. I made a wrong assumption about backwards compatibility of that change, however I still think the behaviour is not exactly what it should be.

Interesting thing Alex Miller pointed out in his comment to CLJ-1894 is that stringify-keys and keywordize-keys are essentially the same function with a different transformation. I think having one function which does a deep transformation of map keys using a transformation supplied by user is a good idea and it could be used to simplify some Clojure libraries.

Proposal:

  • add clojure.walk/transform-keys to walk a map and transform all keys
  • use transform-keys in clojure.walk/stringify-keys & clojure.walk/keywordize-keys

Patch: clj1899-review1.patch

Screened by: Alex Miller

4 Answers

0 votes
by

Comment made by: szalansky

CLJ-1899 patch

0 votes
by

Comment made by: alexmiller

In the patch, {{transform-keys}} should take the arguments in the reverse order {{[m f]}} - generally for any function that is collection -> collection, the collection should be the first arg.

0 votes
by

Comment made by: szalansky

CLJ-1899 patch addressing issues pointed by Alex miller.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1899 (reported by szalansky)
...