diff options
author | Patrick Simianer <p@simianer.de> | 2017-08-04 12:48:11 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2017-08-04 12:48:11 +0200 |
commit | 4bc3eec9fb26d367d174b103f77ccaa9175129ab (patch) | |
tree | 24aa079ac2dcc5255691278390bcba92a94763ae | |
parent | 61b970ea136163f89086b4f764dadbb55ec77ff0 (diff) |
avg-seg-len
-rwxr-xr-x | avg-seg-len | 9 |
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 + |