【发布时间】:2015-10-11 02:52:54
【问题描述】:
在 Python 3 中,如果您想解压列表(或元组)的第一个和其余部分,您可以这样做
x, *y = [1, 2, 3]
#x = 1, y = [2, 3]
如何在 Clojure 的 let 块中执行此操作?我试过:as parts 和
(defn destructurer [vec]
(let [[beginning the-rest :as parts] vec]
[beginning the-rest]
)
)
;; (destructer [1 2 3])
;; [1 2] <- missing the 3
【问题讨论】:
标签: python-3.x clojure iterable-unpacking