[pypy-svn] r29014 - pypy/dist/pypy/doc
auc at codespeak.net
auc at codespeak.net
Tue Jun 20 17:30:53 CEST 2006
Author: auc
Date: Tue Jun 20 17:30:52 2006
New Revision: 29014
Modified:
pypy/dist/pypy/doc/howto-logicobjspace-0.9.txt
Log:
after conflict...
Modified: pypy/dist/pypy/doc/howto-logicobjspace-0.9.txt
==============================================================================
--- pypy/dist/pypy/doc/howto-logicobjspace-0.9.txt (original)
+++ pypy/dist/pypy/doc/howto-logicobjspace-0.9.txt Tue Jun 20 17:30:52 2006
@@ -347,20 +347,20 @@
implementor to drive the search. First, let us see some code driving a
binary depth-first search::
- 1 def first_solution_dfs(space):
- 2 status = space.ask()
- 3 if status == 0:
- 4 return None
- 5 elif status == 1:
- 6 return space
- 7 else:
- 8 new_space = space.clone()
- 9 space.commit(1)
- 10 outcome = first_solution_dfs(space)
- 11 if outcome is None:
- 13 new_space.commit(2)
- 14 outcome = first_solution_dfs(new_space)
- 15 return outcome
+ 1 def first_solution_dfs(space):
+ 2 status = space.ask()
+ 3 if status == 0:
+ 4 return None
+ 5 elif status == 1:
+ 6 return space
+ 7 else:
+ 8 new_space = space.clone()
+ 9 space.commit(1)
+ 10 outcome = first_solution_dfs(space)
+ 11 if outcome is None:
+ 13 new_space.commit(2)
+ 14 outcome = first_solution_dfs(new_space)
+ 15 return outcome
This recursive solver takes a space as argument, and returns the first
space containing a solution or None. Let us examine it piece by piece
More information about the Pypy-commit
mailing list