tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,16 @@
|
|||
(use '[clojure.contrib.combinatorics :only (subsets)])
|
||||
|
||||
(defn of-min-length [min-length]
|
||||
(fn [s] (>= (count s) min-length)))
|
||||
|
||||
(defn runs [c l]
|
||||
(map (partial take l) (take-while not-empty (iterate rest c))))
|
||||
|
||||
(defn is-subseq? [c sub]
|
||||
(some identity (map = (runs c (count sub)) (repeat sub))))
|
||||
|
||||
(defn non-continuous-subsequences [s]
|
||||
(filter (complement (partial is-subseq? s)) (subsets s)))
|
||||
|
||||
|
||||
(filter (of-min-length 2) (non-continuous-subsequences [:a :b :c :d]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue