destructuring

    7热度

    2回答

    我有一个宏,需要一个身体: (defmacro blah [& body] (dostuffwithbody)) 但我想一个可选关键字参数添加到它一样,所以当把它称为可能看起来像以下任一: (blah :specialthingy 0 body morebody lotsofbody) (blah body morebody lotsofboy) 我该怎么做?请注意,我使用的是Cloju

    15热度

    2回答

    我有以下数据结构: {:file #<File /foo.bar>, :resolution {:width 1280, :height 1024}} 我想编写destructures的:resolution钥匙插入width和height符号的功能。类似于 (defn to-directory-name [{{:keys [width height]}} wallpaper] (s

    4热度

    4回答

    我有一个let声明,我想动态解构一个列表。以下是我的解决方案: symList ;; list of some Strings which will become the vector of Symbols to assign to valList ;; list of some values, same length as symList (let [(map read-string sy

    16热度

    4回答

    从Mozilla的JavaScript 1.7 changlog中可以看出,他们添加了解构赋值工具。可悲的是,我不是很喜欢的语法(为什么写a和b两次?): var a, b; [a, b] = f(); 像这样的事情会好了很多: var [a, b] = f(); 这仍然是向后兼容。类似Python的解构不会向后兼容。 反正我已经能够拿出对JavaScript 1.5的最佳解决方案是:

    6热度

    2回答

    我以为我会发布这个,因为我没有真正理解发生的事情,通过猜测工作,我认为如果有人解释它可能会有帮助。 我知道如何在的元素得到: (GET "/something" [some_arg] "this is the response body") 或 (GET "/something" {{some_arg "some_arg"} :params} "this is the response bod