clojure - 为什么这段代码会转换嵌套结构

dag*_*da1 2 clojure

假设我有一个这样的嵌套结构:

(def board [[:x :e :e]
[:o :x :e]
[:o :e :x]])
Run Code Online (Sandbox Code Playgroud)

为什么这段代码将它转换为90%

(apply map vector board)
Run Code Online (Sandbox Code Playgroud)

Yos*_*ark 5

apply 使代码等效于此:

(map vector [:x :e :e] [:o :x :e] [:o :e :x])
Run Code Online (Sandbox Code Playgroud)

map 然后按顺序执行:

(vector :x :o :o) ;; the first elements in the sequences
(vector :e :x :e) ;; the second elements in the sequences
(vector :e :e :x) ;; the third elements in the sequences
Run Code Online (Sandbox Code Playgroud)

并按顺序收集它们以返回.这样可以使原始序列中的"列"成为新行,将原始序列中的"行"作为新列.