Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save terakilobyte/6dad6eee77ab59fbd787 to your computer and use it in GitHub Desktop.
Save terakilobyte/6dad6eee77ab59fbd787 to your computer and use it in GitHub Desktop.
** (CondClauseError) no cond clause evaluated to a true value
Enum.reduce(sentence, %{},
fn(word, acc) ->
cond do
Map.has_key?(acc, word) ->
acc = Map.update(acc, word, 1, &(&1 + 1))
true
acc = Map.put(acc, word, 1)
end
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment