Skip to content

Instantly share code, notes, and snippets.

@jmsevold
Created February 17, 2016 04:28
Show Gist options
  • Save jmsevold/0ec346af33d7a5898779 to your computer and use it in GitHub Desktop.
Save jmsevold/0ec346af33d7a5898779 to your computer and use it in GitHub Desktop.
defmodule Words do
@doc """
Count the number of words in the sentence.
Words are compared case-insensitively.
"""
@spec count(String.t) :: map()
def count(sentence) do
end
end
map = %{}
split_words = String.split(words)
Enum.each(split_words, &(Map.put(map,String.to_atom(&1),1))
# reduce a list of strings to a map whose keys are the strings, and values are a number representing the occurence of that string within the list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment