21

次のデータ構造があります。

{:file #<File /foo.bar>, :resolution {:width 1280, :height 1024}}

:resolutionキーをwidthシンボルheightに分解する関数を書きたいと思います。何かのようなもの

(defn to-directory-name [{{:keys [width height]}} wallpaper]
  (str width "x" height))

破壊でそのようなことは可能ですか?

ありがとう。

4

2 に答える 2

25

最初に :resolution を分解してから、幅と高さを取得する必要があります。

{{:keys [width height]} :resolution}
于 2010-11-29T20:46:37.257 に答える
5
(defn to-directory-name [{{width :width height :height} :resolution}] 
  (str width "x" height))

私のために働きます。

于 2010-11-29T20:46:04.580 に答える