Skip to content

Instantly share code, notes, and snippets.

@abdolence
Created February 11, 2020 19:28
Show Gist options
  • Save abdolence/7d3a669e975a95700e08161733dd10a4 to your computer and use it in GitHub Desktop.
Save abdolence/7d3a669e975a95700e08161733dd10a4 to your computer and use it in GitHub Desktop.
import scala.collection.parallel.CollectionConverters._
import scala.collection.parallel.ParSeq
def parallelFizzbuzz( n: Int )( rules: Int => String ): ParSeq[( Int, String )] = {
(1 to n).par
.map(x => ( x, rules( x ) ) )
}
parallelFizzbuzz( N )( basicFizzbuzzRules ).foreach( println )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment