Skip to content

Instantly share code, notes, and snippets.

@svdberg
Created March 25, 2011 11:25
Show Gist options
  • Save svdberg/886708 to your computer and use it in GitHub Desktop.
Save svdberg/886708 to your computer and use it in GitHub Desktop.
This blows the stack, how do I fix it?
(defn path
[[x & more :as full-list] orgmat p]
(let [maxsize (count orgmat)
new-row (- (count more) 1)
this-row (+ new-row 1)]
(cond
(empty? full-list) (conj p this-row)
(= x 0) (path more orgmat p)
(= x 1) (if (>= new-row (last p))
(path more orgmat p)
(path (reverse (nth orgmat new-row)) orgmat (conj p this-row))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment