[racket] I don't understand structural recursion.

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Sat Sep 17 18:42:09 EDT 2011

Hi Charlie,

Yep, Catalan numbers!

Here's something that may help.  Add the following two lines to the
top of your file --

#lang planet tracer/tracer

(trace-all)

-- and put a concrete call at the end, eg:

(num-distinct-trees 3)

Go to Language | Choose Language... and select the option at the top
(Use the language declared in the source).  When you Run the program,
this will fire up a browser window which will visualize the calls
you're making and the answers they're returning, as trees.  (If you
modify your program to return the actual trees, not just the counts,
you can see them printed as values, too.)

Shriram


Posted on the users mailing list.