[Haskell-beginners] Re: Tutorial/Book with Exercises
divisortheory at gmail.com
Sat Mar 28 01:10:00 EDT 2009
On Fri, Mar 27, 2009 at 4:00 AM, Jason White <jason at jasonjgw.net> wrote:
> Michael Mossey <mpm at 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
> answers are in the appendix if I really need them)?
Alright well I just solved this one after a considerable amount of effort.
The best hint I can offer without giving too much away is to try to think of
a way to implement map and filter in a tail recursive manner (without CPS).
In other words, the return value of the call to map (or filter), should
itself be the recursive call to map (or filter). Writing map and filter in
this manner, the pattern may begin to be more familiar. If you want a more
detailed hint feel free to email me privately, but I don't want to give
anything away to those who would rather not see any more.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners