summaryrefslogtreecommitdiff
path: root/moving-sum
diff options
context:
space:
mode:
authorPatrick Simianer <pks@pks.rocks>2018-08-14 18:23:43 +0200
committerPatrick Simianer <pks@pks.rocks>2018-08-14 18:23:43 +0200
commitaefe594fa5c594719db4e3a050d983577127c1ad (patch)
tree8a22ea5046aa9817efa10863d5e28c9e40a4b41c /moving-sum
parent6d9f77693dc39c2cf3c33a5af419f9bfebda71ec (diff)
moving-sum
Diffstat (limited to 'moving-sum')
-rwxr-xr-xmoving-sum10
1 files changed, 10 insertions, 0 deletions
diff --git a/moving-sum b/moving-sum
new file mode 100755
index 0000000..697f47f
--- /dev/null
+++ b/moving-sum
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+require 'zipf'
+
+sum = 0.0
+ReadFile.readlines_strip(ARGV[0]).each { |i|
+ sum += i.to_f
+ puts sum
+}
+