I haven't actually gotten to this exercise yet, but I feel like this is probably related: http://www.ece.uc.edu/~franco/C511/html/Scheme/ycomb.html. I'm not sure if it will give you some pointers in the right direction. It basically explains how to "abstract out" the recursive part of a function into a separate function, which is basically what you need.
Well, I've got some bad news for you. He doesn't include the answers to the CPS-related questions. Note: YAHT seems to be incomplete in a number of ways, because there are chapter headings that exist only as stubs. However, it's a terrific resource, and my thanks to Hal.
Jason White wrote:
Michael Mossey <mpm@alumni.caltech.edu> wrote:
YAHT has some hard exercises, early on. He introduces continuations in chapter 4, briefly, and then casually asks you to rewrite map and filter in continuation-passing-style. I was stumped.
So am I.
Do you have any hints for these, without giving the answers away (I know the
answers are in the appendix if I really need them)?
I decided to just move on, and I'll come back to continuations when I find them in another book.
Mike
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners