Created
January 12, 2014 15:33
-
-
Save XuefengWu/8386108 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
(1 to 100 by 2).map(v => v * v).sum | |
//Parallel | |
(1 to 100 by 2).par.map(v => v * v).par.sum | |
//reduce can not Parallel | |
(1 to 100 by 2).reduce((acc,v) => acc + v * v) | |
//lazy, read from infinite | |
Stream.from(0).map(_ * 2 + 1).take(50).reduce((acc,v) => acc + v * v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment