Skip to content

Instantly share code, notes, and snippets.

Created June 4, 2012 06:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2866669 to your computer and use it in GitHub Desktop.
Save anonymous/2866669 to your computer and use it in GitHub Desktop.
;; chouser's solution to Infinite Matrix
;; https://4clojure.com/problem/168
(fn [r f & [m n s t]]
(map #(map (fn [x] (f % x)) (r n t)) (r m s)))
(fn r [a b]
({0 ()} b (lazy-cat [(or a 0)]
(r (+ (or a 0) 1) (- (or b 0) 1)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment