Created
February 11, 2020 19:28
-
-
Save abdolence/7d3a669e975a95700e08161733dd10a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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