[racket] building iterators on trees

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed Nov 9 14:52:54 EST 2011

I've been thinking about how to support hash-iterate-first and
hash-iterate-next in Whalesong.  In Whalesong, my functional hash
implementation is based on left-leaning red-black trees.  The
hash-iterate-* functions are a little weird for me since they return
numbers, and I had expected them to produce some opaque, structured
value.

Since I can only use numbers, it makes iteration weirder since I'm
dealing with a non-linear structure.  I cooked up a quick prototype of
an approach:

    http://www.wescheme.org/openEditor?publicId=shady-clunk-blase-saber-decay

treating the number as binary digits, and using it as a description of
a path through the tree.

Is this a reasonable approach?


Posted on the users mailing list.