sum_list = [5,'four','two',10,'one',28,6,'five']
defmodule SumModule do
@numDic %{ 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five' }
def sum_list([]), do: 0
def sum_list([head|tail]) when is_integer(head), do: sum_list(tail) + head
def sum_list([head|tail]), do: sum_list(tail) + sum_list(Enum.map(@numDic, fn {key, value} -> SumModule.convert_to_integer(head,{key,value}) end))
def convert_to_integer(head, {key, value}) when value === head, do: key
def convert_to_integer(head, {key, value}) when value !== head, do: 0
end
IO.puts SumModule.sum_list(sum_list)