[racket] side-effect-free DFS of k-ary tree?

From: Daniel Prager (daniel.a.prager at gmail.com)
Date: Mon Dec 30 08:20:58 EST 2013

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>

Posted on the users mailing list.