Skip to content
Brian Marick edited this page Apr 28, 2017 · 1 revision

Problem 1

We start with this:

reverseTake list n = List.take n list

We can use flip on List.take. That generates a function that expects arguments in the opposite order. In order to keep reverseTake doing the same thing, we have to reverse the arguments to the flipped function:

reverseTake list n = flip List.take list n

Now the parts below and after the = end with the same two arguments. So you can drop them both.

reserveTake = flip List.take

Problem 2

add1 a = (+) a

Clone this wiki locally