exercism/xerlang — pull request #32 by tmcgilchrist (2014-12-15 22:20:05+00:00)
Title: Add solution for hamming_distance back into example.erl

The haming_distance implementation got lost somewhere along the line, rebase perhaps?

Also changed the test to expect `hamming_distance` as the function name, snake_case is the erlang convention.

@kytrinyx For https://github.com/exercism/xerlang/issues/22, we're currently trimming the lists so they are of equal length. Instead we should probably just accept different length lists and complain loudly when they're not equal. e.g.
```erlang
-module(dna).
-export([hamming_distance/2]).

hamming_distance(From, To) ->
Comparisons = lists:zipwith(fun(X,Y) -> case X =:= Y of
true -> 0;
false -> 1
end
end,
From, To),
lists:sum(Comparisons).
```

gives the following when the lists aren't equal in length.
```
module 'dna_tests'
dna_tests: empty_test...*failed*
in function lists:zipwith/3 (lists.erl, line 449)
called as zipwith(#Fun,[],"GAG")
in call from dna:hamming_distance/2 (dna.erl, line 9)
in call from dna_tests:empty_test/0 (dna_tests.erl, line 6)
**error:function_clause
```