Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
9 lines (8 sloc) 313 Bytes
fun main(args: Array<String>) {
val array = arrayOf(50.0, 60.0, 70.0, 70.0, 100.0)
val mean = array.run { sum() / count() }
val variance = array.run {
map { it * it }.run { sum() / count() } - ( sum() / count()) * ( sum() / count())
}
println("mean: $mean, variance: $variance")
}