Skip to content

Instantly share code, notes, and snippets.

@svdberg
Created March 25, 2011 17:30
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/887234 to your computer and use it in GitHub Desktop.
Save svdberg/887234 to your computer and use it in GitHub Desktop.
Why does this hang/don't end?
(defn test-test
[[x & more :as list] orgmat p]
(cond
(empty? list) p
(= x 1) (test-test (nth orgmat (count more)) orgmat (conj p (count more)))
(= x 0) (recur more orgmat p)
true (recur more orgmat p)))
orgmat is in form:
((0 0 0 0 0 0 0 0) (1 0 1 0 0 1 0 0) (1 0 0 0 0 1 0 0) (1 1 1 0 0 1 0 0) (1 1 1 1 0 1 0 1) (1 0 0 0 0 0 0 0) (1 1 1 1 1 1 0 1) (1 1 1 1 0 1 0 0))
meaning:
on a one I can navigate from row-num to col num. so [7,1]=1 means row 7 can navigate to row 1.
Aim is to eventually find the path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment