Tags
#python #sicp
Question
Why is currying?
More specifically, given a function f(x, y) , we can define a function g such that g(x)(y) is equivalent to f(x, y) . Here, g is a higher-order function that takes in a single argument x and returns another function that takes in a single argument y. This transformation is currying.

Tags
#python #sicp
Question
Why is currying?
?

Tags
#python #sicp
Question
Why is currying?
More specifically, given a function f(x, y) , we can define a function g such that g(x)(y) is equivalent to f(x, y) . Here, g is a higher-order function that takes in a single argument x and returns another function that takes in a single argument y. This transformation is currying.
If you want to change selection, open original toplevel document below and click on "Move attachment"

#### Parent (intermediate) annotation

Open it
We can use higher-order functions to convert a function that takes multiple arguments into a chain of functions that each take a single argument. More specifically, given a function f(x, y) , we can define a function g such that g(x)(y) is equivalent to f(x, y) . Here, g is a higher-order function that takes in a single argument x and returns another function that takes in a single argument y . This transformation is called currying.

#### Original toplevel document

1.6 Higher-Order Functions
d is a powerful general computational method for solving differentiable equations. Very fast algorithms for logarithms and large integer division employ variants of the technique in modern computers. 1.6.6 Currying Video: Show Hide <span>We can use higher-order functions to convert a function that takes multiple arguments into a chain of functions that each take a single argument. More specifically, given a function f(x, y) , we can define a function g such that g(x)(y) is equivalent to f(x, y) . Here, g is a higher-order function that takes in a single argument x and returns another function that takes in a single argument y . This transformation is called currying. As an example, we can define a curried version of the pow function: >>> def curried_pow(x): def h(y): return pow(x, y) return h >>&g

#### Summary

status measured difficulty not learned 37% [default] 0

No repetitions