SICP: The 8 Queens Problem
1 year ago I could never do this problem on my own. 1 year later, and 7 weeks into Hacker School I did it.
I followed through the recursion with pencil and paper to ensure that my understanding of the structure of the problem (which was given in the problem) was crystal clear. I understood what the data representation should be to make the implementation of the procedures simple. My struggle was with the implementation.
I only know as much Scheme as was taught (in the book) up to this point in chapter 2. I am using the Dr. Racket IDE to edit and run the code, but I have no idea about how Dr. Racket's debugger works and I really did not want to get into that.
I isolated my issues and I knew my problem was in implementing the filter called safer? . Took me awhile to realize I was getting lists of boolean lists instead of a flat list of booleans. How to flatten it? After a struggle, fold-left came to mind. Don't understand why the op parameter or did not work, but it did work when writing an or function using lambda. A little more logic debugging then it worked.
Feeling good that I stuck with it, that I understood how the program worked, and that eventually got through all the Scheme implementation details.
Some people are thrilled finishing the NYC marathon. I'm thrilled that I got through my personal marathon.
It is hard work to make a program simple. I believe I did that.













