Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
fp2025:lab03 [2025/03/11 17:28]
pdmatei
fp2025:lab03 [2025/03/12 15:40] (current)
pdmatei
Line 23: Line 23:
  
  
-**3.4.** Write a function ''​foldMap''​ which takes values $math[a_1, a_2, \ldots, a_k] from a range and computes $math[f(a_1)\;​op\;​f(a_2)\;​op\;​\ldots f(a_k)].+**3.4.** Write a function ''​foldMap''​ which takes values $math[a_1, a_2, \ldots, a_k] from a range and computes $math[f(a_1)\;​op\;​f(a_2)\;​op\;​\ldots ​\;op\;f(a_k)].
 <code scala> <code scala>
 def foldMap(op: (Int,Int) => Int, f: Int => Int)(start: Int, stop: Int): Int = ??? def foldMap(op: (Int,Int) => Int, f: Int => Int)(start: Int, stop: Int): Int = ???