프로그래밍 TIP/Clojure

conj vs. into

여름나라겨울이야기 2015. 4. 2. 22:57
728x90

(conj 컬렉션A 값)


(conj '(1 2 3) :a)

; '(a 1 2 3)


(into 컬렉션A 컬렉션B)


(into '(1 2 3) '(:a))

; '(a 1 2 3)


conj vs. into


(into '(1 2 3)  '(:a :b :c))

; (:c :b :a 1 2 3)


(reduce conj '(1 2 3) '(:a :b :c))

; (:c :b :a 1 2 3)


반응형