k-means implementation in Scala