, , , . ; , :
(-> (fn [x y]
...)
(reduce init coll))
, , , , , :
(reduce (fn [x y]
...)
init, coll)
, , . , . , .
(defn decreasing-subsequences [xs]
(lazy-seq
(cond (empty? xs) []
(not (next xs)) (list xs)
:else (let [[x & [y :as more]] xs
remainder (decreasing-subsequences more)]
(if (> y x)
(cons [x] remainder)
(cons (cons x (first remainder)) (rest remainder)))))))
reduce :
(apply max-key count (decreasing-subsequences xs))
, , , , , ; , ( , ), , , , . , > in (> y x) , . , , , , .
, , , . , , .