Differences

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

Link to this comparison view

fp2024:lab03 [2024/03/19 09:55]
pdmatei created
fp2024:lab03 [2024/03/19 09:57] (current)
pdmatei
Line 5: Line 5:
   * implement **curry** and **uncurry** functions, and how they should be properly used (review lecture).   * implement **curry** and **uncurry** functions, and how they should be properly used (review lecture).
  
-**3.1.** Define the function ''​foldWith''​ which uses an operation ''​op'',​ and an initial value ''​b''​ to reduce a range of integers to a value. For instance, given that ''​op''​ is addition (+), the result of folding the range 1 to 3 with ''​b = 0''​ will be ''​( ( 0 + 1 ) + 2 + 3 = 6''​. ''​foldWith''​ should be curried (it will take the operation and return another function which expects the bounds). Note that ''​foldWith''​ is **curry**.+**3.1.** Define the function ''​foldWith''​ which uses an operation ''​op'',​ and an initial value ''​b''​ to reduce a range of integers to a value. For instance, given that ''​op''​ is addition (+), the result of folding the range 1 to 3 with ''​b = 0''​ will be ''​( ( 0 + 1 ) + 2 + 3 = 6''​. ''​foldWith''​ should be **curried** (it will take the operation and return another function which expects the bounds).
  
 <code scala> <code scala>