Exercises

The following exercises summarize what we have learned about futures and promises in this chapter, and require implementing custom future factory methods and combinators. Several exercises also deal with several deterministic programming abstractions that were not covered in this chapter, such as single-assignment variables and maps:

  1. Implement a command-line program that asks the user to input a URL of some website, and displays the HTML of that website. Between the time that the user hits ENTER and the time that the HTML is retrieved, the program should repetitively print a . to the standard output every 50 milliseconds, with a 2 second timeout. Use only futures and promises, and avoid synchronization primitives from the previous chapters. ...

Get Learning Concurrent Programming in Scala - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.