[plt-scheme] toy code for doing a ruby-quiz problem (countdown).

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jan 29 11:28:49 EST 2007

On Jan 29, 2007, at 11:22 AM, Danny Yoo wrote:

>> However, I am seeing some occasional weirdness that I haven't been  
>> able to trace completely yet.
>> So the result there is bizarre: somehow, another instance of a NUM  
>> is being constructed, but I've taken pains to only instantiate  
>> NUMs in a single place.
> Ok, traced it.  Good grief, that was silly of me.  The bug was in  
> the way I was memoizing expressions: I have to ensure the cache is  
> clean between runs.  What happened was that previous runs were  
> interfering with current runs.  (I also forgot that equal? dives  
> into structures if the inspector is #f.)  I have to be much more  
> careful about state.

HtDP, first rule on state: add an init function for all state  
variables to your program. (I should have added, run when needed,  
except that I have relied on drscheme to run it between executions).

-- Matthias

> The program is still way too slow though; I'll have to see what  
> other optimizations I can make to prune the search space.
> Thanks!
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.