KBK (25 April 2002) - The fact that Tcl allows new control structures to be defined at the script level by means of uplevel and upvar has led to its being a popular platform for prototyping search algorithms that require backtracking. The general idea is that you can program a proc that makes a nondeterministic choice, and evaluates a script to follow through on the consequences of that choice.
The Wiki offers one toy example, used for Solving cryptarithms like
S E N D + M O R E ----------- M O N E Y
RS examines some of the possibilities in Playing Prolog and Playing predicate logic. Searching a star in space is also interesting, as is Neil Madden's State Space Searching in Tcl.
http://www.usenix.org/publications/library/proceedings/tcl96/clark.html