Skip to content

Instantly share code, notes, and snippets.

@koozdra
Last active April 23, 2019 18:19
Show Gist options
  • Save koozdra/ee09b026915c4987aaecac61f32a92f0 to your computer and use it in GitHub Desktop.
Save koozdra/ee09b026915c4987aaecac61f32a92f0 to your computer and use it in GitHub Desktop.
_.reduce(
([numItemsSeen, mean], num) => [
numItemsSeen + 1,
mean + (num - mean) / (numItemsSeen + 1)
],
[0, 0]
)([3, 4, 5, 6, 10, 100, 9]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment