Created
September 9, 2011 07:15
-
-
Save anonymous/1205660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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