Skip to content

Instantly share code, notes, and snippets.

@fffej
Created July 4, 2009 12:16
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/140551 to your computer and use it in GitHub Desktop.
Save fffej/140551 to your computer and use it in GitHub Desktop.
(defn depth-first-search
"Search new states first until goal is reached."
[start goal? successors]
(tree-search (list start) goal? successors concat))
(defn reverse-concat
"Prepend y to start of x"
[x y]
(concat y x))
(defn breadth-first-search
"Search old states first until goal is reached."
[start goal? successors]
(tree-search (list start) goal? successors reverse-concat))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment