Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Looks like you forgot to attach the fmap function code. However, it is not difficult to guess what was there:
https://jsfiddle.net/k8jkuh3d/
function square(x) {
return x * x;
}
function add(a, b) {
return a + b
}
function fmap(a, gen) {
return function() {
return a(gen.apply(null, arguments))
}
}
var squareAdd = fmap(square, add)
squareAdd(2, 3) // 25
squareAdd(5, 7) // 144
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question