Rename directory for back-end tests
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
tailRecursive fun <T, A> Iterator<T>.foldl(acc : A, foldFunction : (e : T, acc : A) -> A) : A =
|
||||
if (!hasNext()) acc
|
||||
else foldl(foldFunction(next(), acc), foldFunction)
|
||||
|
||||
fun box() : String {
|
||||
val sum = (1..1000000).iterator().foldl(0) { (e : Int, acc : Long) ->
|
||||
acc + e
|
||||
}
|
||||
|
||||
return if (sum == 500000500000) "OK" else "FAIL: $sum"
|
||||
}
|
||||
Reference in New Issue
Block a user