Exercise 6.16 in Thompson is Complete!

Submitted by metaperl on Wed, 07/20/2005 - 6:31am.

Well, 6 weeks ago I was low in motivation and actually bought 2 C++ books and intended to learn C++ and enter ICFP contest using it.

However, I think I am too old to learn C++... I really just didn't get the hang of it. Actually, I think I rushed things.

But anyway, Haskell is much easier on my head. I have been struggling with the image superposition exercises (6.16) for a long long time. In the process I found a bug in the Haskell tracer, hat:

http://permalink.gmane.org/gmane.comp.lang.haskell.hat/176

And I learned how to use GHC's Debug.Trace.

I also was hit smack dab in the face with Haskell's non-determinism. I was using Debug.Trace.trace() and was confused about how output from trace and program output were interleaved:

http://article.gmane.org/gmane.comp.lang.haskell.cafe/7769/match=

And of course, I learned that lists in Haskell often end up reversed when you process them to generate another list... I kept staring at my final result until I realized that it was correct, only upside-down!

This was an excellent exercise and I'm glad that I did not skim over it. You've got to learn the language and how to debug the language as well and Thompson has once again shown why he has probably the best book introducing the Haskell language (at least better than Algorithms, haven't messed with my Hudak intro book).