تدمير خريطة في خريطة أخرى؟
-
29-09-2019 - |
سؤال
لدي بنية البيانات التالية:
{: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