-
-
Save AlchemistCamp/c37b6347606e537d0a16d68fbe6dc29d to your computer and use it in GitHub Desktop.
Episode 4 source (lesson 2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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