Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
fp2025:hw1 [2025/03/21 12:39] dmihai |
fp2025:hw1 [2026/04/24 10:17] (current) andrei.nicola |
||
|---|---|---|---|
| Line 78: | Line 78: | ||
| </code> | </code> | ||
| - | **9.** Implement an alternative to the previous function, namely **foldRight**. Applying ''foldRight'' on the set ''{x,y,z}'' with initial value ''b'' should produce: ''a op (b op (c op b))''. Use direct recursion instead of tail recursion. | + | **9.** Implement an alternative to the previous function, namely **foldRight**. Applying ''foldRight'' on the set ''{x,y,z}'' with initial value ''b'' should produce: ''x op (y op (z op b))''. Use direct recursion instead of tail recursion. |
| <code scala> | <code scala> | ||
| def foldRightSet | def foldRightSet | ||