Sha256: fb2613aec8bfe7ebade7e9c66558a95e878bb0845e1a09f9d6d15c1874b6f11f

Contents?: true

Size: 1.79 KB

Versions: 362

Compression:

Stored size: 1.79 KB

Contents

## Hints
According to [this terminology](http://chimera.labs.oreilly.com/books/1230000000929/ch01.html#sec_terminology) you should write a *parallel* and *deterministic*
program and (by all means!) let Scala deal with the *concurrency* aspect.
Or else your code could quickly get messy and error-prone with all kinds of nasty
concurrency bugs. In particular your program could become indeterministic
which spells in practice: very (in fact, VERY) hard to debug, test and reason about.

Having said that it might be a good idea to first write a sequential solution (and
use the test suite to verify it).
Only then should you try to parallelize it while keeping the sequential and parallel
portions of your code as separate as possible.

A first iteration could be using Scala's [parallel collections](http://docs.scala-lang.org/overviews/parallel-collections/overview.html). You might find
that this is almost too simple (especially if you have followed our advice and
already have a sequential solution).

For the second iteration we recommend you try a solution with [scala.concurrent.Future](http://www.scala-lang.org/api/current/scala/concurrent/Future$.html).
You can consult [this tutorial](http://danielwestheide.com/blog/2013/01/09/the-neophytes-guide-to-scala-part-8-welcome-to-the-future.html) and [its sequel](http://danielwestheide.com/blog/2013/01/16/the-neophytes-guide-to-scala-part-9-promises-and-futures-in-practice.html) for some help.
Make sure that you
- have only one single blocking call to wait for the result
- that it is at the very end of your program, and
- that it has a timeout.

`scala.concurrent.Future` is used in many libraries and the doctor's advice for
parallel and asynchronous programming in Scala. So it is essential for mastering
the language and it should become part of your Scala armory.

Version data entries

362 entries across 362 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.179 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.178 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.177 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.176 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.175 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.174 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.173 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.172 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.171 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.170 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.169 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.167 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.166 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.165 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.164 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.163 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.162 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.161 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md
trackler-2.2.1.160 tracks/scala/exercises/parallel-letter-frequency/.meta/hints.md