Haskell problem followup

Having read a bit of the next chapter and discovered the zipWith function, I now have a higher-order non-recursive solution to the makeChange problem, viz.

makeChange1 :: Int -> [Int] -> [Int]
makeChange1 amt vs = zipWith div modvs vs
    where modvs = scanl mod amt vs

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.