Skip to content

Instantly share code, notes, and snippets.

@Eckankar
Created November 10, 2015 19:07
Show Gist options
  • Save Eckankar/b39581c496b7a23576a9 to your computer and use it in GitHub Desktop.
Save Eckankar/b39581c496b7a23576a9 to your computer and use it in GitHub Desktop.
avgSum = fst . avgSum' 0 0
where avgSum' sum n [] = ([], sum `div` n)
avgSum' sum n (x:xs) =
let (rs, avg) = avgSum' (sum+x) (n+1) xs
in ((x-avg) : rs, avg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment