summaryrefslogtreecommitdiff
path: root/avg-seg-len
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-08-04 12:48:11 +0200
committerPatrick Simianer <p@simianer.de>2017-08-04 12:48:11 +0200
commit4bc3eec9fb26d367d174b103f77ccaa9175129ab (patch)
tree24aa079ac2dcc5255691278390bcba92a94763ae /avg-seg-len
parent61b970ea136163f89086b4f764dadbb55ec77ff0 (diff)
avg-seg-len
Diffstat (limited to 'avg-seg-len')
-rwxr-xr-xavg-seg-len9
1 files changed, 9 insertions, 0 deletions
diff --git a/avg-seg-len b/avg-seg-len
new file mode 100755
index 0000000..ee68827
--- /dev/null
+++ b/avg-seg-len
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+lens = []
+while line = STDIN.gets
+ lens << line.strip.split.size
+end
+
+puts lens.inject(:+)/lens.size.to_f
+