2010-04-26 19 views

cevap

32

concat yapay sekans döndürür.

user=> (doc concat) 
------------------------- 
clojure.core/concat 
([] [x] [x y] [x y & zs]) 
    Returns a lazy seq representing the concatenation of the elements in the supplied colls. 

içine bir vektör geri dönüştürebilirsiniz: bu konuda oldukça hızlı yüzden geçişlerini kullanan

user=> (into [] (concat [1 2] [3 4] [5 6])) 
[1 2 3 4 5 6] 

içine.

+16

Aynı performansa sahip biraz daha kısa kodlar için de vec var. –

+1

Herkes nedenini biliyor mu? –

+0

"Neden" in, gerçekten bir liste olmayan bir LazySeq döndürdüğüne inanıyorum. Ayrıca Clojure vektörleri tembel değildir. Http://stackoverflow.com/q/12206806/1814970 adresine bakın. – marcelocra

İlgili konular