Coins problem in Erlang
You can easily give more structure to your code:

-module(coins).
-export([coins/2]).

-spec coins([CoinValue::integer()], Goal::integer()) -&gt; Combinations::integer().

coins(_, 0) -&gt; 1;
coins([], _) -&gt; 0;
coins(_, Goal) when Goal &lt; 0 -&gt; 0;
coins([CoinValue|Rest], Goal) -&gt;
  WithCoinValue = coins([H|T], Goal-H),
  WithoutCoinValue = coins(T, Goal),
  WithCoinValue + WithoutCoinValue.