mjburgess 11 days ago | next [–]
These definitions don’t really give you the idea, rather often just code examples..
“The ideas”, in my view:
Monoid | = | units that can be joined together |
Functor | = | context for running a single-input function |
Applicative | = | context for multi-input functions |
Monad | = | context for sequence-dependent operations |
Lifting | = | converting from one context to another |
Sum type | = | something is either A or B or C… |
Product type | = | a record |
= | something is both A and B and C | |
Partial application | = | defaulting an argument to a function |
Currying | = | passing some arguments later |
= | rephrasing a function to return a functions of n-1 arguments when given 1, st. the final function will compute the desired result | |
EDIT: Context | = | compiler information that changes how the program will be interpreted (, executed, compiled,…) |
Eg., context | = | run in the future, run across a list, redirect the i/o, … |
— Functional programming jargon in plain English
— Hacker News
.
Currying and partial function application are often conflated. One of the significant differences between the two is that a call to a partially applied function returns the result right away, not another function down the currying chain; this distinction can be illustrated clearly for functions whose arity is greater than two.
.
Partial application can be seen as evaluating a curried function at a fixed point, e.g. given and
then
or simply
where curries
‘s first parameter.
— Wikipedia on Currying
.
.
2022.07.16 Saturday ACHK