Created
June 19, 2019 19:18
-
-
Save allison-casey/045c048f43737cc6984500c7b5464cda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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