Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 18th, 2012  |  syntax: None  |  size: 0.28 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ;; uochan's solution to http://4clojure.com/problem/53
  2.  
  3. (fn [coll]
  4.   (let [inc-seq? (fn [x] (every?  #(= -1 %) (map #(apply - %) (partition 2 1 x))))
  5.         ls (filter inc-seq? (mapcat (fn [n] (partition n 1 coll)) (range 1 (count coll))))]
  6.     (if (-> ls last count (= 1)) () (last ls))))