Re: Walking a tree

2013-07-06 Thread looselytyped
Dear Stanislav, Thank you. You got me going down the right path. Upon looking around for a BFS solution, I came across this blog post that had me going down the right direction. Which leads me to Carlo's response -- You a

Re: Walking a tree

2013-07-06 Thread Carlo Zancanaro
Give this a go: (defn ^:private walk-tree* [all seen to-do] (when-let [[curr & others] to-do] (if (contains? seen curr) (recur all seen others) (lazy-seq (when-let [node (first (filter #(= (:v %) curr) all))] (println node) (cons curr (walk

Re: Walking a tree

2013-07-06 Thread Stanislav Sedov
On Jul 6, 2013, at 9:33 AM, looselytyped wrote: > Good morning everyone! > > I have a problem that I have been struggling with for a few days now. I have > a directed acyclic graph that I am trying to walk, and can't seem to figure > out a to prevent my walking already visited branches. Here

Walking a tree

2013-07-06 Thread looselytyped
Good morning everyone! I have a problem that I have been struggling with for a few days now. I have a directed acyclic graph that I am trying to walk, and can't seem to figure out a to prevent my walking already visited branches. Here is the code (def values [{:v "a" :parent ["b"]} {:v