chickadee » rope » rope

rope? objectprocedure
rope-length ropeprocedure
rope-depth ropeprocedure

A rope is either a leaf containing a string or a binary tree consisting of such leaves.

Length and depth are stored on each node, so rope-length and rope-depth are constant time queries.

rope? simply tests if its argument is a rope.