Skip to content

Instantly share code, notes, and snippets.

@fffej
Created July 3, 2009 21:00
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 fffej/140303 to your computer and use it in GitHub Desktop.
Save fffej/140303 to your computer and use it in GitHub Desktop.
(defn tree-search
"Find a state that satisfies goal? Start with states, and search
according to successors and combiner"
[states goal? successors combiner]
(dbg :search "Search %s" states)
(cond
(empty? states) nil
(goal? (first states)) (first states)
:else (recur
(combiner (successors (first states)) (rest states))
goal?
successors
combiner)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment