From 38896af4281d2e191cbde15836a23e4c0274fff6 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 4 Jun 2016 11:02:43 +0200 Subject: Add mean payment by month --- src/client/elm/Utils/List.elm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/client/elm/Utils') 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) -- cgit v1.2.3