aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils/List.elm
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/List.elm
parent9dfa7a7e2c6fac564a456b11623c04d0b26fbce5 (diff)
downloadbudget-38896af4281d2e191cbde15836a23e4c0274fff6.tar.gz
budget-38896af4281d2e191cbde15836a23e4c0274fff6.tar.bz2
budget-38896af4281d2e191cbde15836a23e4c0274fff6.zip
Add mean payment by month
Diffstat (limited to 'src/client/elm/Utils/List.elm')
-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)