Skip to content

Instantly share code, notes, and snippets.

@svdberg
Created March 25, 2011 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svdberg/887415 to your computer and use it in GitHub Desktop.
Save svdberg/887415 to your computer and use it in GitHub Desktop.
Doesnt terminate.
(defn path
[[x & more :as full-list] orgmat p]
(let [maxsize (count orgmat)
new-row (- (count more))
this-row (count more)]
(cond
(empty? full-list) p
(= this-row 0) p
(= x 0) (recur more orgmat p)
(= x 1) (if (< new-row (last p))
(recur (reverse (nth orgmat new-row)) orgmat (conj p this-row))
(recur more orgmat p)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment