-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# Scala parallel crash course | ||
# Scala parallel programming crash course | ||
|
||
## Parallel collections | ||
|
||
This simplest (but by no means the only) way to get started with parallel programming in Scala is using Scala [parallel collections](https://docs.scala-lang.org/overviews/parallel-collections/overview.html). | ||
|
||
```scala | ||
val rng = scala.util.Random(42) | ||
val v = Vector.fill(10)(rng.nextGaussian) | ||
v | ||
|
||
``` | ||
|
||
|
||
|
||
## Futures | ||
|
||
|
||
|
||
|
||
## Effects | ||
|
||
Futures are a powerful and flexible way to construct parallel and concurrent applications. However, they aren't a perfect fit to a pure functional approach to programming. The fact that futures "fire" as soon as they are created means that they have a *side-effect*, and that is potentially problematic. People have developed more principled, functional effects systems for Scala, such as the [Cats effect](https://typelevel.org/cats-effect/) IO monad, and these provide better mechanisms for parallel and concurrent programming in Scala. They are, however, (well) beyond the scope of this course. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# Scala parallel crash course | ||
# Scala parallel programming crash course | ||
|
||
## Parallel collections | ||
|
||
This simplest (but by no means the only) way to get started with parallel programming in Scala is using Scala [parallel collections](https://docs.scala-lang.org/overviews/parallel-collections/overview.html). | ||
|
||
```scala | ||
val rng = scala.util.Random(42) | ||
val v = Vector.fill(10)(rng.nextGaussian) | ||
v | ||
|
||
``` | ||
|
||
|
||
|
||
## Futures | ||
|
||
|
||
|
||
|
||
## Effects | ||
|
||
Futures are a powerful and flexible way to construct parallel and concurrent applications. However, they aren't a perfect fit to a pure functional approach to programming. The fact that futures "fire" as soon as they are created means that they have a *side-effect*, and that is potentially problematic. People have developed more principled, functional effects systems for Scala, such as the [Cats effect](https://typelevel.org/cats-effect/) IO monad, and these provide better mechanisms for parallel and concurrent programming in Scala. They are, however, (well) beyond the scope of this course. | ||
|
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