#49 Split a sequence
(fn mac [n vec]
(list (take n vec) (take-last (- (count vec) n) vec))
)
//
(fn mac [n vec]
(map (fn [v2] (map (fn [v3] (last v3)) v2 )) (map val (group-by (fn [[i v]] (if (> i (dec n)) true false)) (map-indexed vector vec) ) ) )
)
//처음에 한버전
#29 Get the Caps
(fn mac [para]
(clojure.string/join "" (re-seq #"[A-Z]" para))
)
#32 Duplicate a Sequence
(fn mac [para]
(mapcat #(list % %) para)
)
#50 Split by Type
(fn mac [m]
(map val (group-by type m))
)
728x90
'프로그래밍 언어 노트 > Clojure' 카테고리의 다른 글
[Clojure] 4Clojure 4 (0) | 2019.07.21 |
---|---|
[Clojure] 4Clojure Easy 3 (0) | 2019.07.13 |
[Clojure] 4Clojure Easy 1 (0) | 2019.07.10 |
[Clojure] 클로저 디자인패턴 (0) | 2019.06.28 |
[Clojure 연습] 5. 4Clojure Easy 1 (0) | 2018.10.15 |