scala: ideomatic and optimized versions
Merge pull request #5 from luben/master

scala: ideomatic and optimized versions