scala code snippets