aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils
diff options
context:
space:
mode:
authorJoris2016-06-04 11:02:43 +0200
committerJoris2016-06-04 11:02:43 +0200
commit38896af4281d2e191cbde15836a23e4c0274fff6 (patch)
tree0d7df152cc84beaa79cc9fa055db1e7992c4ac91 /src/client/elm/Utils
parent9dfa7a7e2c6fac564a456b11623c04d0b26fbce5 (diff)
Add mean payment by month
Diffstat (limited to 'src/client/elm/Utils')
-rw-r--r--src/client/elm/Utils/List.elm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/client/elm/Utils/List.elm b/src/client/elm/Utils/List.elm
index 4886418..cc57d9f 100644
--- a/src/client/elm/Utils/List.elm
+++ b/src/client/elm/Utils/List.elm
@@ -1,5 +1,6 @@
module Utils.List exposing
( groupBy
+ , mean
)
import Dict
@@ -11,3 +12,6 @@ groupBy f xs =
in Dict.insert (f item) (item :: groupItems) dict
in List.foldr addItem Dict.empty xs
|> Dict.toList
+
+mean : List Int -> Int
+mean xs = (List.sum xs) // (List.length xs)