Thanks, Nathan, that did help.
I'm still stuck, however, figuring out how to return the values as a
flat sequence of vectors. Maybe I'm just missing the right function
from the API.
Here's where I'm at right now:
(defn get-paths
([n] (get-paths n [0 0] '()))
([n point path]
(cond (points-equal? (vector n n) point) (reverse (conj path point))
(out-of-bounds? n point) nil
(blocked? point) nil
:else (list (get-paths n (inc-y point) (conj path point))
(get-paths n (inc-x point) (conj path point))))))
So, right now when I call the function with nothing blocked
(get-paths 1)
it returns
((nil ([0 0] [0 1] [1 1])) (([0 0] [1 0] [1 1]) nil))
but what I want is
(([0 0] [0 1] [1 1]) ([0 0] [1 0] [1 1]))
so that a call to (count) would return the total number of paths.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en