Created
August 20, 2015 04:27
-
-
Save edubkendo/feff3c50fbc8a5c4bbfd to your computer and use it in GitHub Desktop.
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
defmodule WordCount do | |
def run do | |
System.argv | |
|> path | |
|> file | |
|> size | |
|> count | |
|> IO.puts | |
end | |
def path(filename) do | |
filename | |
|> Path.expand | |
end | |
def file(filepath) do | |
{:ok, text} = File.read(filepath) | |
text | |
end | |
def size(text) do | |
text |> String.length | |
end | |
def count(length) do | |
length / 20 | |
end | |
end | |
WordCount.run |
Should clarify, this is for getting a wordcount from the scripts of Japanese games one has played while taking part in the Read More or Die 多読 contest .
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage