Closed analyticbastard closed 7 years ago
Thanks for the patch, but I'm afraid macros are outside Medley's scope.
Would you consider adding a macros namespace?
Otherwise, which is a medley macros equivalent ?
No, sorry. I want Medley to have a tight focus, and the macros in your patch are outside that scope.
I'm not sure what library would be considered a "macros equivalent". Perhaps make your own?
Hi - There is a pair of macros for this problem in the Tupelo library.
http://cloojure.github.io/doc/tupelo/tupelo.core.html#var-vals-.3Emap
See vals->map
and with-map-vals
.
Alan
On Fri, Jun 16, 2017 at 8:39 AM, Javier Arriero notifications@github.com wrote:
A repetitive patter I have come across is this
(zipmap [:a :b :c] [a b c])
which is needed to build a map as an input to a map destructuring function (or build the map manually). The bindings are very often named identically to the input map's keys.
This set of functions remove the redundancy of having to reapeat the binding symbol as a keyword and reduces the boilerplate.
Several flavours provided: the map's key types can be plain key, qualified key, string and symbol.
You can view, comment on, or merge this pull request online at:
https://github.com/weavejester/medley/pull/21 Commit Summary
- Add flavours of selfmap macros for concise zipmap
File Changes
- M src/medley/core.cljc https://github.com/weavejester/medley/pull/21/files#diff-0 (44)
- M test/medley/core_test.cljc https://github.com/weavejester/medley/pull/21/files#diff-1 (35)
Patch Links:
- https://github.com/weavejester/medley/pull/21.patch
- https://github.com/weavejester/medley/pull/21.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/weavejester/medley/pull/21, or mute the thread https://github.com/notifications/unsubscribe-auth/AGwXB7JaKLgG2BRiLv5K649zG3zt9pQ5ks5sEqG4gaJpZM4N8nbg .
A repetitive patter I have come across is this
which is needed to build a map as an input to a map destructuring function (or build the map manually). The bindings are very often named identically to the input map's keys.
This set of functions remove the redundancy of having to reapeat the binding symbol as a keyword and reduces the boilerplate.
Several flavours provided: the map's key types can be plain key, qualified key, string and symbol.