To correct some typos.  Sorry!

> > How about this:
> >
> > makeChanges total coins =
> >   tail $ map fst $ scanl (\(how_many,rest) -> divMod rest) (0,total) coins
>
> You may want to push it further:
>
> makeChanges total =
>   tail . map fst . scanl (divMod . snd) (0,total)
>
> which, IMHO, is a little obfuscated (although some people may think this is
> actually easier to understand).  If the reader does not know what divMod does,
> the code can be mysterious.  However in your original code, the expression
>
> let (how_many,rest) = divMod n coin_val in ...
>
> is quite self-explanatary.

... self-explanatory.

> Higher-orderness, is used unwisely, can be bad.

... if used unwisely, ...

-- Zhanyong Wan


Reply via email to