我正在尝试使用大量(~50)getter和setter方法(一些具有不规则名称)实现一个巨大的Java接口.我认为使用宏来减少代码量会很好.而不是
(def data (atom {:x nil}))
(reify HugeInterface
(getX [this] (:x @data))
(setX [this v] (swap! data assoc :x v)))
Run Code Online (Sandbox Code Playgroud)
我希望能够写作
(def data (atom {:x nil}))
(reify HugeInterface
(set-and-get getX setX :x))
Run Code Online (Sandbox Code Playgroud)
这个set-and-get宏(或类似的东西)可能吗?我无法让它发挥作用.