Currying

From HandWiki - Reading time: 18 min

Short description: Transforming a function in such a way that it only takes a single argument

In mathematics and computer science, currying is the technique of translating a function that takes multiple arguments into a sequence of families of functions, each taking a single argument.

In the prototypical example, one begins with a function [math]\displaystyle{ f:(X\times Y)\to Z }[/math] that takes two arguments, one from [math]\displaystyle{ X }[/math] and one from [math]\displaystyle{ Y, }[/math] and produces objects in [math]\displaystyle{ Z. }[/math] The curried form of this function treats the first argument as a parameter, so as to create a family of functions [math]\displaystyle{ f_x :Y\to Z. }[/math] The family is arranged so that for each object [math]\displaystyle{ x }[/math] in [math]\displaystyle{ X, }[/math] there is exactly one function [math]\displaystyle{ f_x. }[/math]

In this example, [math]\displaystyle{ \mbox{curry} }[/math] itself becomes a function, that takes [math]\displaystyle{ f }[/math] as an argument, and returns a function that maps each [math]\displaystyle{ x }[/math] to [math]\displaystyle{ f_x. }[/math] The proper notation for expressing this is verbose. The function [math]\displaystyle{ f }[/math] belongs to the set of functions [math]\displaystyle{ (X\times Y)\to Z. }[/math] Meanwhile, [math]\displaystyle{ f_x }[/math] belongs to the set of functions [math]\displaystyle{ Y\to Z. }[/math] Thus, something that maps [math]\displaystyle{ x }[/math] to [math]\displaystyle{ f_x }[/math] will be of the type [math]\displaystyle{ X\to [Y\to Z]. }[/math] With this notation, [math]\displaystyle{ \mbox{curry} }[/math] is a function that takes objects from the first set, and returns objects in the second set, and so one writes [math]\displaystyle{ \mbox{curry}:[(X\times Y)\to Z]\to (X\to [Y\to Z]). }[/math] This is a somewhat informal example; more precise definitions of what is meant by "object" and "function" are given below. These definitions vary from context to context, and take different forms, depending on the theory that one is working in.

Currying is related to, but not the same as, partial application.[1][2] The example above can be used to illustrate partial application; it is quite similar. Partial application is the function [math]\displaystyle{ \mbox{apply} }[/math] that takes the pair [math]\displaystyle{ f }[/math] and [math]\displaystyle{ x }[/math] together as arguments, and returns [math]\displaystyle{ f_x. }[/math] Using the same notation as above, partial application has the signature [math]\displaystyle{ \mbox{apply}:([(X\times Y)\to Z] \times X) \to [Y\to Z]. }[/math] Written this way, application can be seen to be adjoint to currying.

The currying of a function with more than two arguments can be defined by induction.

Currying is useful in both practical and theoretical settings. In functional programming languages, and many others, it provides a way of automatically managing how arguments are passed to functions and exceptions. In theoretical computer science, it provides a way to study functions with multiple arguments in simpler theoretical models which provide only one argument. The most general setting for the strict notion of currying and uncurrying is in the closed monoidal categories, which underpins a vast generalization of the Curry–Howard correspondence of proofs and programs to a correspondence with many other structures, including quantum mechanics, cobordisms and string theory.[3]

The concept of currying was introduced by Gottlob Frege,[4][5] developed by Moses Schönfinkel,[6][5][7][8][9][10][11] and further developed by Haskell Curry.[8][10][12][13]

Uncurrying is the dual transformation to currying, and can be seen as a form of defunctionalization. It takes a function [math]\displaystyle{ f }[/math] whose return value is another function [math]\displaystyle{ g }[/math], and yields a new function [math]\displaystyle{ f' }[/math] that takes as parameters the arguments for both [math]\displaystyle{ f }[/math] and [math]\displaystyle{ g }[/math], and returns, as a result, the application of [math]\displaystyle{ f }[/math] and subsequently, [math]\displaystyle{ g }[/math], to those arguments. The process can be iterated.

Motivation

Currying provides a way for working with functions that take multiple arguments, and using them in frameworks where functions might take only one argument. For example, some analytical techniques can only be applied to functions with a single argument. Practical functions frequently take more arguments than this. Frege showed that it was sufficient to provide solutions for the single argument case, as it was possible to transform a function with multiple arguments into a chain of single-argument functions instead. This transformation is the process now known as currying.[14] All "ordinary" functions that might typically be encountered in mathematical analysis or in computer programming can be curried. However, there are categories in which currying is not possible; the most general categories which allow currying are the closed monoidal categories.

Some programming languages almost always use curried functions to achieve multiple arguments; notable examples are ML and Haskell, where in both cases all functions have exactly one argument. This property is inherited from lambda calculus, where multi-argument functions are usually represented in curried form.

Currying is related to, but not the same as partial application.[1][2] In practice, the programming technique of closures can be used to perform partial application and a kind of currying, by hiding arguments in an environment that travels with the curried function.

History

The "Curry" in "Currying" is a reference to logician Haskell Curry, who used the concept extensively, but Moses Schönfinkel had the idea six years before Curry.[10] The alternative name "Schönfinkelisation" has been proposed.[15] In the mathematical context, the principle can be traced back to work in 1893 by Frege.[4][5]

The originator of the word "currying" is not clear. David Turner says the word was coined by Christopher Strachey in his 1967 lecture notes Fundamental Concepts in Programming Languages,[16] but although the concept is mentioned and Curry is mentioned in the context of higher-order functions, the word "currying" does not appear in the notes and Curry is not associated with the concept.[7] John C. Reynolds defined "currying" in a 1972 paper, but did not claim to have coined the term.[8]

Definition

Currying is most easily understood by starting with an informal definition, which can then be molded to fit many different domains. First, there is some notation to be established. The notation [math]\displaystyle{ X \to Y }[/math] denotes all functions from [math]\displaystyle{ X }[/math] to [math]\displaystyle{ Y }[/math]. If [math]\displaystyle{ f }[/math] is such a function, we write [math]\displaystyle{ f \colon X \to Y }[/math]. Let [math]\displaystyle{ X \times Y }[/math] denote the ordered pairs of the elements of [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] respectively, that is, the Cartesian product of [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math]. Here, [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] may be sets, or they may be types, or they may be other kinds of objects, as explored below.

Given a function

[math]\displaystyle{ f \colon (X \times Y) \to Z }[/math],

currying constructs a new function

[math]\displaystyle{ g \colon X \to (Y \to Z) }[/math].

That is, [math]\displaystyle{ g }[/math] takes an argument of type [math]\displaystyle{ X }[/math] and returns a function of type [math]\displaystyle{ Y\to Z }[/math]. It is defined by

[math]\displaystyle{ g(x)(y)=f(x,y) }[/math]

for [math]\displaystyle{ x }[/math] of type [math]\displaystyle{ X }[/math] and [math]\displaystyle{ y }[/math] of type [math]\displaystyle{ Y }[/math]. We then also write

[math]\displaystyle{ \text{curry}(f)=g. }[/math]

Uncurrying is the reverse transformation, and is most easily understood in terms of its right adjoint, the function [math]\displaystyle{ \operatorname{apply}. }[/math]

Set theory

In set theory, the notation [math]\displaystyle{ Y^X }[/math] is used to denote the set of functions from the set [math]\displaystyle{ X }[/math] to the set [math]\displaystyle{ Y }[/math]. Currying is the natural bijection between the set [math]\displaystyle{ A^{B\times C} }[/math] of functions from [math]\displaystyle{ B\times C }[/math] to [math]\displaystyle{ A }[/math], and the set [math]\displaystyle{ (A^C)^B }[/math] of functions from [math]\displaystyle{ B }[/math] to the set of functions from [math]\displaystyle{ C }[/math] to [math]\displaystyle{ A }[/math]. In symbols:

[math]\displaystyle{ A^{B\times C}\cong (A^C)^B }[/math]

Indeed, it is this natural bijection that justifies the exponential notation for the set of functions. As is the case in all instances of currying, the formula above describes an adjoint pair of functors: for every fixed set [math]\displaystyle{ C }[/math], the functor [math]\displaystyle{ B\mapsto B\times C }[/math] is left adjoint to the functor [math]\displaystyle{ A \mapsto A^C }[/math].

In the category of sets, the object [math]\displaystyle{ Y^X }[/math] is called the exponential object.

Function spaces

In the theory of function spaces, such as in functional analysis or homotopy theory, one is commonly interested in continuous functions between topological spaces. One writes [math]\displaystyle{ \text{Hom}(X,Y) }[/math] (the Hom functor) for the set of all functions from [math]\displaystyle{ X }[/math] to [math]\displaystyle{ Y }[/math], and uses the notation [math]\displaystyle{ Y^X }[/math] to denote the subset of continuous functions. Here, [math]\displaystyle{ \text{curry} }[/math] is the bijection

[math]\displaystyle{ \text{curry}:\text{Hom}(X\times Y, Z) \to \text{Hom}(X, \text{Hom}(Y,Z)) , }[/math]

while uncurrying is the inverse map. If the set [math]\displaystyle{ Y^X }[/math] of continuous functions from [math]\displaystyle{ X }[/math] to [math]\displaystyle{ Y }[/math] is given the compact-open topology, and if the space [math]\displaystyle{ Y }[/math] is locally compact Hausdorff, then

[math]\displaystyle{ \text{curry} : Z^{X\times Y}\to (Z^Y)^X }[/math]

is a homeomorphism. This is also the case when [math]\displaystyle{ X }[/math], [math]\displaystyle{ Y }[/math] and [math]\displaystyle{ Y^X }[/math] are compactly generated,[17](chapter 5)[18] although there are more cases.[19][20]

One useful corollary is that a function is continuous if and only if its curried form is continuous. Another important result is that the application map, usually called "evaluation" in this context, is continuous (note that eval is a strictly different concept in computer science.) That is,

[math]\displaystyle{ \begin{align} &&\text{eval}:Y^X \times X \to Y \\ && (f,x) \mapsto f(x) \end{align} }[/math]

is continuous when [math]\displaystyle{ Y^X }[/math] is compact-open and [math]\displaystyle{ Y }[/math] locally compact Hausdorff.[21] These two results are central for establishing the continuity of homotopy, i.e. when [math]\displaystyle{ X }[/math] is the unit interval [math]\displaystyle{ I }[/math], so that [math]\displaystyle{ Z^{I\times Y} \cong (Z^Y)^I }[/math] can be thought of as either a homotopy of two functions from [math]\displaystyle{ Y }[/math] to [math]\displaystyle{ Z }[/math], or, equivalently, a single (continuous) path in [math]\displaystyle{ Z^Y }[/math].

Algebraic topology

In algebraic topology, currying serves as an example of Eckmann–Hilton duality, and, as such, plays an important role in a variety of different settings. For example, loop space is adjoint to reduced suspensions; this is commonly written as

[math]\displaystyle{ [\Sigma X,Z] \approxeq [X, \Omega Z] }[/math]

where [math]\displaystyle{ [A,B] }[/math] is the set of homotopy classes of maps [math]\displaystyle{ A \rightarrow B }[/math], and [math]\displaystyle{ \Sigma A }[/math] is the suspension of A, and [math]\displaystyle{ \Omega A }[/math] is the loop space of A. In essence, the suspension [math]\displaystyle{ \Sigma X }[/math] can be seen as the cartesian product of [math]\displaystyle{ X }[/math] with the unit interval, modulo an equivalence relation to turn the interval into a loop. The curried form then maps the space [math]\displaystyle{ X }[/math] to the space of functions from loops into [math]\displaystyle{ Z }[/math], that is, from [math]\displaystyle{ X }[/math] into [math]\displaystyle{ \Omega Z }[/math].[21] Then [math]\displaystyle{ \text{curry} }[/math] is the adjoint functor that maps suspensions to loop spaces, and uncurrying is the dual.[21]

The duality between the mapping cone and the mapping fiber (cofibration and fibration)[17](chapters 6,7) can be understood as a form of currying, which in turn leads to the duality of the long exact and coexact Puppe sequences.

In homological algebra, the relationship between currying and uncurrying is known as tensor-hom adjunction. Here, an interesting twist arises: the Hom functor and the tensor product functor might not lift to an exact sequence; this leads to the definition of the Ext functor and the Tor functor.

Domain theory

In order theory, that is, the theory of lattices of partially ordered sets, [math]\displaystyle{ \text{curry} }[/math] is a continuous function when the lattice is given the Scott topology.[22] Scott-continuous functions were first investigated in the attempt to provide a semantics for lambda calculus (as ordinary set theory is inadequate to do this). More generally, Scott-continuous functions are now studied in domain theory, which encompasses the study of denotational semantics of computer algorithms. Note that the Scott topology is quite different than many common topologies one might encounter in the category of topological spaces; the Scott topology is typically finer, and is not sober.

The notion of continuity makes its appearance in homotopy type theory, where, roughly speaking, two computer programs can be considered to be homotopic, i.e. compute the same results, if they can be "continuously" refactored from one to the other.

Lambda calculi

In theoretical computer science, currying provides a way to study functions with multiple arguments in very simple theoretical models, such as the lambda calculus, in which functions only take a single argument. Consider a function [math]\displaystyle{ f(x,y) }[/math] taking two arguments, and having the type [math]\displaystyle{ (X \times Y)\to Z }[/math], which should be understood to mean that x must have the type [math]\displaystyle{ X }[/math], y must have the type [math]\displaystyle{ Y }[/math], and the function itself returns the type [math]\displaystyle{ Z }[/math]. The curried form of f is defined as

[math]\displaystyle{ \text{curry}(f) = \lambda x.(\lambda y.(f(x,y))) }[/math]

where [math]\displaystyle{ \lambda }[/math] is the abstractor of lambda calculus. Since curry takes, as input, functions with the type [math]\displaystyle{ (X\times Y)\to Z }[/math], one concludes that the type of curry itself is

[math]\displaystyle{ \text{curry}:((X \times Y)\to Z) \to (X \to (Y \to Z)) }[/math]

The → operator is often considered right-associative, so the curried function type [math]\displaystyle{ X \to (Y \to Z) }[/math] is often written as [math]\displaystyle{ X \to Y \to Z }[/math]. Conversely, function application is considered to be left-associative, so that [math]\displaystyle{ f(x, y) }[/math] is equivalent to

[math]\displaystyle{ ((\text{curry}(f) \; x) \;y) = \text{curry}(f) \; x \;y }[/math].

That is, the parenthesis are not required to disambiguate the order of the application.

Curried functions may be used in any programming language that supports closures; however, uncurried functions are generally preferred for efficiency reasons, since the overhead of partial application and closure creation can then be avoided for most function calls.

Type theory

In type theory, the general idea of a type system in computer science is formalized into a specific algebra of types. For example, when writing [math]\displaystyle{ f \colon X \to Y }[/math], the intent is that [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] are types, while the arrow [math]\displaystyle{ \to }[/math] is a type constructor, specifically, the function type or arrow type. Similarly, the Cartesian product [math]\displaystyle{ X \times Y }[/math] of types is constructed by the product type constructor [math]\displaystyle{ \times }[/math].

The type-theoretical approach is expressed in programming languages such as ML and the languages derived from and inspired by it: CaML, Haskell and F#.

The type-theoretical approach provides a natural complement to the language of category theory, as discussed below. This is because categories, and specifically, monoidal categories, have an internal language, with simply-typed lambda calculus being the most prominent example of such a language. It is important in this context, because it can be built from a single type constructor, the arrow type. Currying then endows the language with a natural product type. The correspondence between objects in categories and types then allows programming languages to be re-interpreted as logics (via Curry–Howard correspondence), and as other types of mathematical systems, as explored further, below.

Logic

Under the Curry–Howard correspondence, the existence of currying and uncurrying is equivalent to the logical theorem [math]\displaystyle{ ((A \land B) \to C) \Leftrightarrow (A \to (B \to C)) }[/math], as tuples (product type) corresponds to conjunction in logic, and function type corresponds to implication.

The exponential object [math]\displaystyle{ Q^P }[/math] in the category of Heyting algebras is normally written as material implication [math]\displaystyle{ P\to Q }[/math]. Distributive Heyting algebras are Boolean algebras, and the exponential object has the explicit form [math]\displaystyle{ \neg P \lor Q }[/math], thus making it clear that the exponential object really is material implication.[23]

Category theory

The above notions of currying and uncurrying find their most general, abstract statement in category theory. Currying is a universal property of an exponential object, and gives rise to an adjunction in cartesian closed categories. That is, there is a natural isomorphism between the morphisms from a binary product [math]\displaystyle{ f \colon (X \times Y) \to Z }[/math] and the morphisms to an exponential object [math]\displaystyle{ g \colon X \to Z^Y }[/math].

This generalizes to a broader result in closed monoidal categories: Currying is the statement that the tensor product and the internal Hom are adjoint functors; that is, for every object [math]\displaystyle{ B }[/math] there is a natural isomorphism:

[math]\displaystyle{ \mathrm{Hom}(A\otimes B, C) \cong \mathrm{Hom}(A, B\Rightarrow C) . }[/math]

Here, Hom denotes the (external) Hom-functor of all morphisms in the category, while [math]\displaystyle{ B\Rightarrow C }[/math] denotes the internal hom functor in the closed monoidal category. For the category of sets, the two are the same. When the product is the cartesian product, then the internal hom [math]\displaystyle{ B\Rightarrow C }[/math] becomes the exponential object [math]\displaystyle{ C^B }[/math].

Currying can break down in one of two ways. One is if a category is not closed, and thus lacks an internal hom functor (possibly because there is more than one choice for such a functor). Another way is if it is not monoidal, and thus lacks a product (that is, lacks a way of writing down pairs of objects). Categories that do have both products and internal homs are exactly the closed monoidal categories.

The setting of cartesian closed categories is sufficient for the discussion of classical logic; the more general setting of closed monoidal categories is suitable for quantum computation.[24]

The difference between these two is that the product for cartesian categories (such as the category of sets, complete partial orders or Heyting algebras) is just the Cartesian product; it is interpreted as an ordered pair of items (or a list). Simply typed lambda calculus is the internal language of cartesian closed categories; and it is for this reason that pairs and lists are the primary types in the type theory of LISP, Scheme and many functional programming languages.

By contrast, the product for monoidal categories (such as Hilbert space and the vector spaces of functional analysis) is the tensor product. The internal language of such categories is linear logic, a form of quantum logic; the corresponding type system is the linear type system. Such categories are suitable for describing entangled quantum states, and, more generally, allow a vast generalization of the Curry–Howard correspondence to quantum mechanics, to cobordisms in algebraic topology, and to string theory.[3] The linear type system, and linear logic are useful for describing synchronization primitives, such as mutual exclusion locks, and the operation of vending machines.

Contrast with partial function application

Currying and partial function application are often conflated.[1][2] 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.[25]

Given a function of type [math]\displaystyle{ f \colon (X \times Y \times Z) \to N }[/math], currying produces [math]\displaystyle{ \text{curry}(f) \colon X \to (Y \to (Z \to N)) }[/math]. That is, while an evaluation of the first function might be represented as [math]\displaystyle{ f(1, 2, 3) }[/math], evaluation of the curried function would be represented as [math]\displaystyle{ f_\text{curried}(1)(2)(3) }[/math], applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling [math]\displaystyle{ f_\text{curried}(1) }[/math], we are left with a function that takes a single argument and returns another function, not a function that takes two arguments.

In contrast, partial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of [math]\displaystyle{ f }[/math] above, we might fix (or 'bind') the first argument, producing a function of type [math]\displaystyle{ \text{partial}(f) \colon (Y \times Z) \to N }[/math]. Evaluation of this function might be represented as [math]\displaystyle{ f_\text{partial}(2, 3) }[/math]. Note that the result of partial function application in this case is a function that takes two arguments.

Intuitively, partial function application says "if you fix the first argument of the function, you get a function of the remaining arguments". For example, if function div stands for the division operation x/y, then div with the parameter x fixed at 1 (i.e., div 1) is another function: the same as the function inv that returns the multiplicative inverse of its argument, defined by inv(y) = 1/y.

The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to plus_one. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument.

Partial application can be seen as evaluating a curried function at a fixed point, e.g. given [math]\displaystyle{ f \colon (X \times Y \times Z) \to N }[/math] and [math]\displaystyle{ a \in X }[/math] then [math]\displaystyle{ \text{curry}(\text{partial}(f)_a)(y)(z) = \text{curry}(f)(a)(y)(z) }[/math] or simply [math]\displaystyle{ \text{partial}(f)_a = \text{curry}_1(f)(a) }[/math] where [math]\displaystyle{ \text{curry}_1 }[/math] curries f's first parameter.

Thus, partial application is reduced to a curried function at a fixed point. Further, a curried function at a fixed point is (trivially), a partial application. For further evidence, note that, given any function [math]\displaystyle{ f(x,y) }[/math], a function [math]\displaystyle{ g(y,x) }[/math] may be defined such that [math]\displaystyle{ g(y,x) = f(x,y) }[/math]. Thus, any partial application may be reduced to a single curry operation. As such, curry is more suitably defined as an operation which, in many theoretical cases, is often applied recursively, but which is theoretically indistinguishable (when considered as an operation) from a partial application.

So, a partial application can be defined as the objective result of a single application of the curry operator on some ordering of the inputs of some function.

See also

References

  1. 1.0 1.1 1.2 cdiggins (24 May 2007). "Currying != Generalized Partial Application?!". http://lambda-the-ultimate.org/node/2266. 
  2. 2.0 2.1 2.2 "Partial Function Application is not Currying". The Uncarved Block. 7 August 2020. https://www.uncarved.com/articles/not-currying/. 
  3. 3.0 3.1 Baez, John C.; Stay, Mike (6 June 2009). "Physics, Topology, Logic and Computation: A Rosetta Stone". in Coecke, Bob. New Structures for Physics. Lecture Notes in Physics. 813: New Structures for Physics. Berlin, Heidelberg: Springer. 5 July 2010. pp. 95–172. doi:10.1007/978-3-642-12821-9_2. ISBN 978-3-642-12821-9. https://math.ucr.edu/home/baez/rosetta/rose3.pdf. 
  4. 4.0 4.1 Frege, Gottlob (1893). "§ 36" (in de). Grundgesetze der arithmetik. Book from the collections of University of Wisconsin - Madison, digitized by Google on 26 August 2008. Jena: Hermann Pohle. pp. 54–55. https://archive.org/details/bub_gb_LZ5tAAAAMAAJ/page/n89. This scan is also available at https://www.google.com/books/edition/Grundgesetze_der_arithmetik/LZ5tAAAAMAAJ, and another scan is available at https://gallica.bnf.fr/ark:/12148/bpt6k77790t/f85.item. 
  5. 5.0 5.1 5.2 Quine, W. V. (1967). "Introduction to Moses Schönfinkel's 1924 "On the building blocks of mathematical logic"". in van Heijenoort, Jean. From Frege to Gödel: A Source Book in Mathematical Logic, 1879-1931. Harvard University Press. pp. 355–357. ISBN 9780674324497. 
  6. Schönfinkel, Moses (September 1924). written at Moskau. "Über die Bausteine der mathematischen Logik". Mathematische Annalen (Berlin?: Springer) 92 (3–4): 305–316. doi:10.1007/BF01448013. http://www.cip.ifi.lmu.de/~langeh/test/1924%20-%20Schoenfinkel%20-%20Ueber%20die%20Bausteine%20der%20mathematischen%20Logik.pdf. 
  7. 7.0 7.1 Strachey, Christopher (April 2000). "Fundamental Concepts in Programming Languages" (in en). Higher-Order and Symbolic Computation 13: 11–49. doi:10.1023/A:1010000313106. ISSN 1573-0557. https://doi.org/10.1023/A:1010000313106. "There is a device originated by Schönfinkel, for reducing operators with several operands to the successive application of single operand operators.". 
  8. 8.0 8.1 8.2 Originally published as Reynolds, John C. (1 August 1972). "Definitional interpreters for higher-order programming languages". in Rosemary Shields (in en). Proceedings of the ACM annual conference - ACM '72. 2. ACM Press. pp. 717–740. doi:10.1145/800194.805852. ISBN 9781450374927. http://portal.acm.org/citation.cfm?doid=800194.805852. "In the last line we have used a trick called Currying (after the logician H. Curry) to solve the problem of introducing a binary operation into a language where all functions must accept a single argument. (The referee comments that although "Currying" is tastier, "Schönfinkeling” might be more accurate.)"  Republished as Reynolds, John C. (1998). "Definitional Interpreters for Higher-Order Programming Languages". Higher-Order and Symbolic Computation (Boston: Kluwer Academic Publishers) 11 (4): 363–397. doi:10.1023/A:1010027404223. 13. https://surface.syr.edu/cgi/viewcontent.cgi?article=1012&context=lcsmith_other. 
  9. Slonneger, Kenneth; Kurtz, Barry L. (1995). "Curried Functions, 5.1: Concepts and Examples, Chapter 5: The Lambda Calculus". Formal Syntax and Semantics of Programming Languages: A Laboratory Based Approach. Addison-Wesley Publishing Company. p. 144. ISBN 0-201-65697-3. https://cdn.preterhuman.net/texts/science_and_technology/artificial_intelligence/Formal%20Syntax%20and%20Semantics%20of%20Programming%20Languages%20-%20Kenneth%20Slonneger.pdf#page=161. 
  10. 10.0 10.1 10.2 Curry, Haskell B. (1980). Barwise, Jon; Keisler, H. Jerome; Kunen, Kenneth. eds. "Some Philosophical Aspects of Combinatory Logic". The Kleene Symposium: Proceedings of the Symposium Held June 18-24, 1978 at Madison, Wisconsin, U.S.A. (Studies in Logic and the Foundations of Mathematics). Studies in Logic and the Foundations of Mathematics (North-Holland Publishing Company, imprint of Elsevier) 101: 85–101. doi:10.1016/S0049-237X(08)71254-0. ISBN 9780444853455. ISSN 0049-237X. "Some contemporary logicians call this way of looking at a function "currying", because I made extensive use of it; but Schönfinkel had the idea some 6 years before I did.". 
  11. "Currying Schonfinkelling". Cunningham & Cunningham, Inc.. 6 May 2012. http://wiki.c2.com/?CurryingSchonfinkelling. 
  12. Barendregt, Henk; Barendsen, Erik (March 2000). Introduction to Lambda Calculus (Revised ed.). p. 8. https://www.cse.chalmers.se/research/group/logic/TypesSS05/Extra/geuvers.pdf. 
  13. Curry, Haskell; Feys, Robert (1958). Combinatory logic. I (2 ed.). Amsterdam, Netherlands: North-Holland Publishing Company. 
  14. Hutton, Graham; Jones, Mark P., eds (November 2002). "Frequently Asked Questions for comp.lang.functional, 3. Technical topics, 3.2. Currying". University of Nottingham Computer Science. http://www.cs.nott.ac.uk/~gmh/faq.html#currying. 
  15. Heim, Irene; Kratzer, Angelika (January 2, 1998) (in en). Semantics in Generative Grammar. Malden, Massachusetts: Blackwell Publishers, an imprint of Wiley. ISBN 0-631-19712-5. https://cs.brown.edu/courses/csci2951-k/papers/heim00.pdf. 
  16. Turner, David (1 Jun 1997). "Programming language, Currying, or Schonfinkeling?, #9 / 14". http://computer-programming-forum.com/26-programming-language/976f118bb90d8b15.htm. 
  17. 17.0 17.1 May, Jon Peter (1999). A concise course in algebraic topology. Chicago lectures in mathematics. Chicago, Ill.: University of Chicago Press. pp. 39–55. ISBN 0-226-51183-9. OCLC 41266205. http://www.math.uchicago.edu/~may/CONCISE/ConciseRevised.pdf. 
  18. "compactly generated topological space". 28 May 2023. https://ncatlab.org/nlab/show/compactly+generated+topological+space. 
  19. Tillotson, J.; Booth, Peter I. (March 1980). written at Memorial University of Newfoundland. "Monoidal closed, Cartesian closed and convenient categories of topological spaces". Pacific Journal of Mathematics (Berkeley, California: Mathematical Sciences Publishers) 88 (1): 35–53. doi:10.2140/pjm.1980.88.35. ISSN 0030-8730. https://msp.org/pjm/1980/88-1/pjm-v88-n1-p03-s.pdf. 
  20. "convenient category of topological spaces". 11 August 2023. https://ncatlab.org/nlab/show/convenient+category+of+topological+spaces. 
  21. 21.0 21.1 21.2 Rotman, Joseph Jonah (1988). "Chapter 11". An introduction to algebraic topology. Graduate texts in mathematics; 119. New York: Springer-Verlag. ISBN 978-0-387-96678-6. OCLC 17383909. https://books.google.com/books?id=waq9mwUmcQgC. 
  22. Barendregt, Hendrik Pieter (1984). "Theorems 1.2.13, 1.2.14". The lambda calculus: its syntax and semantics. Studies in logic and the foundations of mathematics. 103 (Rev. ed.). North-Holland, an imprint of Elsevier. ISBN 978-0-444-87508-2. 
  23. Mac Lane, Saunders; Moerdijk, Ieke (1992). "Chapter I. Categories of Functors; sections 7. Propositional Calculus, 8. Heyting Algebras, and 9. Quantifiers as Adjoints" (in en). Sheaves in Geometry and Logic: A First Introduction to Topos Theory. New York: Springer-Verlag, part of Springer Science & Business Media. pp. 48–57. ISBN 978-0-387-97710-2. https://books.google.com/books?id=SGwwDerbEowC&pg=PA48. 
  24. Abramsky, Samson; Coecke, Bob (5 March 2007). "A categorical semantics of quantum protocols" (in en). Logic in Computer Science (LICS 2004): Proceedings, 19th Annual IEEE Symposium, Turku, Finland, 2004 (IEEE Computer Society Press). 
  25. Lee, G. Kay (15 May 2013). "Functional Programming in 5 Minutes". Slides. http://slid.es/gsklee/functional-programming-in-5-minutes. 

External links




Licensed under CC BY-SA 3.0 | Source: https://handwiki.org/wiki/Currying
11 views | Status: cached on July 17 2024 23:31:03
↧ Download this article as ZWI file
Encyclosphere.org EncycloReader is supported by the EncyclosphereKSF