Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个序列,如:
[1 2 3 4 5 6]
如何将其拆分为clojure中的每3个相邻元素?就像下面这样:
([1 2 3] [2 3 4] [3 4 5] [4 5 6])
clojure.core 中的函数是首选!
见分区:
user=> (partition 3 1 [1 2 3 4 5 6]) ((1 2 3) (2 3 4) (3 4 5) (4 5 6))