Skip to content
Snippets Groups Projects
exercise-2.md 4.28 KiB

Exercise 2

Use the following commands to make a fresh clone of your repository:

git clone -b exercise-2 git@gitlab.epfl.ch:lamp/student-repositories-s21/cs206-GASPAR.git exercise-2

Update the README.md file with your solutions. Don't forget to list the group members's SCIPER numbers.

Problem 1: Aggregate

In this week's lecture, you have been introduced to the aggregate method of ParSeq[A] (and other parallel data structures...). It has the following signature:

def aggregate[B](z: B)(f: (B, A) => B, g: (B, B) => B): B

Discuss, as a group, what aggregate does and what its arguments represent.

Question 1

Consider the parallel sequence xs containing the three elements x1, x2 and x3. Also consider the following call to aggregate: