anchor.diff:  avg([], Len, Sum) ->
       Sum / Len.
   
  +%% Returns the standard deviation of Xs, which is a list of numbers.
   std_dev(Xs) ->
       std_dev(Xs, avg(Xs)).
   
  +%% Returns the standard deviation of Xs, which is a list of numbers whose
  +%% average is Avg.
   std_dev(Xs, Avg) ->
       Sums = lists:foldl(
                fun(V, Acc) -> D = V - Avg, Acc + (D * D) end,
                0, Xs),
       math:sqrt(Sums / (length(Xs) - 1)).
  +
  +%% Returns the first element in Xs where Pred(X) is true, or nil if none
  +%% satisfies Pred.
  +ffilter([H | T], Pred) ->
  +    case Pred(H) of
  +        true -> H;
  +        false -> ffilter(T, Pred)
  +    end;
  +ffilter([] , _) -> nil.
  
positive.code: random_bit() ->
      random:uniform(2) - 1.
  
  avg(Xs) ->
      avg(Xs, 0, 0).
  
  
negative.code: -module(utils).
  -export([repeatedly/2, random_bit/0, avg/1, std_dev/1, std_dev/2, ffilter/2]).
  
  repeatedly(0, _) ->
      [];
  