Skip to content
Snippets Groups Projects
Commit d8a465e7 authored by Olivier Blanvillain's avatar Olivier Blanvillain
Browse files

Update recitation-session-2.md

- Remove type incorrect hint for uncurry2 (I don't think this hint helps understanding the question...)
- Rename f' to g in the curry2 description (someone asked why we are taking the derivative of f...)
- Swap the arguments of curry2/uncurry2, `(Double, Int)` is more convinient to give an example with `Math.pow`
parent 8ed7c77e
No related branches found
No related tags found
No related merge requests found
......@@ -40,20 +40,18 @@ _Hint_: What values should be returned by `repeated(x => x + 1, 0)` and `repeate
## Exercise 3.1
Define the function `curry2`, that curries a two arguments function. That is, `curry2(f) = f'` such that `f(x, y) == (f'(x))(y)`
Define the function `curry2`, that curries a two arguments function. That is, `curry2(f) = g` such that `f(x, y) == (g(x))(y)`
```scala
def curry2(f: (Int, Double) => Boolean): Int => (Double => Boolean) = ???
def curry2(f: (Double, Int) => Boolean): Double => (Int => Boolean) = ???
```
_Hint_: what should `curry2((x, y) => x + y)(1.0)` return?
## Exercise 3.2
Define the function `uncurry2`. It takes a curried function, and creates a two-argument function.
```scala
def uncurry2(f: Int => Double => Boolean): (Int, Double) => Boolean = ???
def uncurry2(f: Double => Int => Boolean): (Double, Int) => Boolean = ???
```
## Exercise 4.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment