Zhanyong Wan <[EMAIL PROTECTED]> writes:

> 
> How about this:
> 
> makeChanges total coins =
>   tail $ map fst $ scanl (\(how_many,rest) -> divMod rest) (0,total) coins
> 
> But I doubt this is easier to understand.
No, but I hope it will help me getting away a bit for explicit
recursion. And it's anyway a better training for me to understand
functional programming.
> 
> BTW, your first two branches can be combined:
> 
> makeChange 0 = map (const 0)
I added it later, before just one branch was there, it was just
playing around a bit to see if I got it ;-)


Regards
Friedrich

-- 
for e-mail reply remove all after .com 

Reply via email to