Skip to content

Instantly share code, notes, and snippets.

Created September 9, 2011 07:15
Show Gist options
  • Save anonymous/1205660 to your computer and use it in GitHub Desktop.
Save anonymous/1205660 to your computer and use it in GitHub Desktop.
;; chouser's solution to Sequs Horribilis
;; https://4clojure.com/problem/112
(fn [limit xs]
(second ((fn f [[limit] xs]
(if (coll? xs)
(let [rs (take-while #(<= 0 (first %))
(reductions f [limit] xs))]
[(first (last rs)) (map second (rest rs))])
[(- limit xs) xs]))
[limit] xs)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment