Scala code snippets