That last definition multiplied zeros coming out of the recursion, but I believe this one is good: myprod l = prod l id id where prod [] k b = k 1 prod (x:xs) k b = if x == 0 then b 0 else prod xs (\ z -> k (x * z)) b My goal was to use CPS to do it. Did I succeed? Also, is there another way to do the same thing without passing b through all those recursions? I'm not good enough with Haskell's syntax to see how to do it. Michael --- On Mon, 4/20/09, michael rice <nowgate@yahoo.com> wrote:
|