Comments (4)
I think there is a difference.
When you partially apply k
arguments to a function with n
formal parameters, you get back a new function that still needs n - k
arguments. (Assuming k < n
, of course.)
When you auto-curry a function, you get a function that has useful behavior when supplied 1
, 2
, ..., or n
arguments. If you supply k
arguments, you get back an already auto-curried function with n - k
formal parameters.
const f = (a, b, c, d, e) => a + b + c + d + e;
partial(f, 1, 2) ≍ (c, d, e) => 1 + 2 + c + 2 + e;
// But if
const g = autocurry(f)(1, 2);
// then
g ≍ (c, d, e) => 1 + 2 + c + d + e
g ≍ c => (d, e) => 1 + 2 + c + d + e
g ≍ (c, d) => e => 1 + 2 + c + d + e
g ≍ c => d => e => 1 + 2 + c + d + e
So you can call this "dynamic partial application", but it's not partial application as it's usually used.
from functional-programming-jargon.
You're not wrong, auto-currying is essentially dynamic partial
application. The only reason to describe it as "curry" is due to libraries
like Ramda and Lodash using it for the practice
On Tue, Nov 22, 2016, 7:24 AM stereobooster [email protected]
wrote:
The simplest example for currying:
(A,B) -> C convert to (A) -> (B -> C)
So partial application is application to curried function
((A,B) -> C)(A) convert to ((A) -> (B -> C))(A)
From this definition I can not see difference between Auto-currying and
partial application. Am I wrong?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#124, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAB-4KIdu8pHnSAOcqNWITSnEPiz-D7Oks5rAwkRgaJpZM4K5kE8
.
from functional-programming-jargon.
Maybe add a bit of history nerdiness?
This replacement mechanism simplifies work in both combinatory logic and lambda calculus and would later be called currying, after Haskell Curry. While Curry attributed the concept to Schönfinkel, it had already been used by Frege.
from functional-programming-jargon.
I think this is addressed in the current definitions. Reopen if you disagree.
from functional-programming-jargon.
Related Issues (20)
- Add a section on higher-kinded types HOT 2
- Explanation of `lens` HOT 2
- TOC refers to absent anchor tags HOT 2
- Idempotent inaccurate HOT 2
- Volunteering - Polish translation HOT 4
- Closure appears twice in the document HOT 2
- Avoid polluting globals HOT 2
- Add memoization HOT 1
- Add Identity Function
- Category, Functor, Monad, Comonad, etc. should mention algebraic laws HOT 1
- Natural transformations HOT 1
- Functors are maps for categories HOT 3
- Category example is a preorder/partial order HOT 1
- Suggestions from HN HOT 1
- Add Total Functions HOT 1
- Organize for extensibility HOT 3
- Functor example does not make any sense HOT 2
- Explain why HOT 1
- Monad chain does exist now in JS HOT 3
- Is array concatenation a monoid?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from functional-programming-jargon.