题
我有以下数据结构:
{:file #<File /foo.bar>, :resolution {:width 1280, :height 1024}}
我想写一个破坏的功能 :resolution
钥匙进入 width
和 height
符号。就像是
(defn to-directory-name [{{:keys [width height]}} wallpaper]
(str width "x" height))
像破坏性那样可能吗?
谢谢。
解决方案
您必须首先破坏:解决方案,然后获得宽度和高度:
{{:keys [width height]} :resolution}
其他提示
(defn to-directory-name [{{width :width height :height} :resolution}]
(str width "x" height))
为我工作。
不隶属于 StackOverflow