Our professor used this in the assignment. I don't think "The binary version of a function" exist after searching about it in Google. What do you think it means?
Say we have a function add that adds a bunch of numbers. Rather than writing add(3, 5, 4, 1) we want to use currying to create an adder function that can be extended using a chain of calls. We would then have adder(3)(5)(4)(1)(). Let us assume we have the currying function that can create this adder given the add2 function (the binary version of add) and a start value. Let us call it curry. Then we have adder = curry(add2, 0).
I think he means a function that accepts only two arguments, so it just adds two numbers. His example function add(3, 5, 4, 1) would be a function that accepts any number of arguments and adds them all, but add2 would only accept two arguments, so add2(3, 5) would be 8. "The binary version of a function" in this case means a binary function (a function accepting two arguments).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With