Skip to content

Instantly share code, notes, and snippets.

View built's full-sized avatar

Matt Youell built

View GitHub Profile
@built
built / gist:42971
Created January 4, 2009 01:07 — forked from anonymous/gist:42949
Didn't like that I had to reassemble the Coins list. Took advantage of parametric temp variables (See Coins variable)
-module(change2).
-export([find_variations/2]).
-export([count_change/1]).
find_variations(0, _) -> 1; % No amount given.
find_variations(_, []) -> 0; % No coins given.
find_variations(Amount, _) % Amount is impossible.
when Amount < 0 -> 0;
find_variations(Amount, [Coin|Rest]=Coins) ->