Skip to content

Instantly share code, notes, and snippets.

@allison-casey
Created June 19, 2019 19:18
Show Gist options
  • Save allison-casey/045c048f43737cc6984500c7b5464cda to your computer and use it in GitHub Desktop.
Save allison-casey/045c048f43737cc6984500c7b5464cda to your computer and use it in GitHub Desktop.
public static A reduce<T, A>(Func<A, T, A> fn, A accum, T[] iterable) {
int idx = 0;
int len = iterable.Length;
while(idx < len) {
accum = fn(accum, iterable[idx]);
idx += 1;
}
return accum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment