[racket] side-effect-free DFS of k-ary tree?
Hi Ben
One useful tactic for problem-solving is to solve a simpler, related
problem first, and then go back to the real thing with additional insight.
In this case, can you write a program to list all the paths in the tree
from root to leaf?
Some more hints:
- Review the docs on letrec syntax; here you're using letrec like a
plain let
- Instead of "backtrack", consider returning #f (false) when you hit a
leaf that's a non-match
- Use symbols instead of strings in your example-tree: '(E (B (S)) (U
(V) ...)
- Consider using first and rest instead of car, cdr and friends
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131231/9a2ff2fc/attachment.html>