anchor.diff:  -module(utils).
  --export([repeatedly/2, random_bit/0, avg/1, std_dev/1, std_dev/2]).
  +-export([repeatedly/2, random_bit/0, avg/1, std_dev/1, std_dev/2, ffilter/2]).
   
   repeatedly(0, _) ->
       [];
  
positive.code: avg([], Len, Sum) ->
      Sum / Len.
  
  std_dev(Xs) ->
      std_dev(Xs, avg(Xs)).
  
  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)).
  
negative.code: random_bit() ->
      random:uniform(2) - 1.
  
  %% Returns the average of Xs, which is a list of numbers.
  avg(Xs) ->
      avg(Xs, 0, 0).
  
  