开发者

How does this code work? [duplicate]

开发者 https://www.devze.com 2023-03-03 23:04 出处:网络
This question already has an ans开发者_如何学Gower here: Closed 11 years ago. Possible Duplicate:
This question already has an ans开发者_如何学Gower here: Closed 11 years ago.

Possible Duplicate:

weirdness in clojure map function

How does the following Clojure code work?

(def transpose (partial apply map list))

(println (transpose [[2 6 5] [1 0 9]]))


it equal to (map list [2 6 5] [1 0 9]), which in turn means (map #(list %1 %2) [2 6 5] [1 0 9]), the two vectors consumed at the same time, returns: ((2 1) (6 0) (5 9))

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号