Created
July 4, 2009 12:16
-
-
Save fffej/140551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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