Skip to content

Instantly share code, notes, and snippets.

@AlchemistCamp AlchemistCamp/word_count.exs Secret
Last active Jul 26, 2018

Embed
What would you like to do?
Episode 4 source (lesson 2)
filename = IO.gets("File to count the words from: ") |> String.trim()
words =
File.read!(filename)
|> String.split(~r{(\\n|[^\w'])+})
|> Enum.filter(fn x -> x != "" end)
words |> Enum.count() |> IO.puts()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.