Topic: curried functions

topics > computer science > programming > Group: function

formal methods and languages

evaluation in an environment
function call
functional programming
inheritance by delegation
lambda calculus
no need for variables
object slice


To curry a function means to produce a function with fewer parameters. For instance the expression '2+3' is the same as the curried function '+2' applied to 3. Note the '+2' does not modify 3. Instead it uses 3 as an argument. '+2' is the curried function '+' applied to 2. Curried functions are also called slices or partial instantiation. A similar idea is combinators which can remove variables. (cbb 5/80 12/92)
Subtopic: closures up

Quote: anonymous inner classes implement closures; e.g., makeAdder(n) [»bensBW2_1999]
Quote: a typed assembly language enforces closures, tuples, and abstract data types without restricting low-level optimizations such as register allocation
Quote: a closure is a rule for evaluating the expression and an environment; it is an R-value that is not atomic [»straC8_1967]

Subtopic: comprehension up

Quote: the ext combinator is a universal construct for comprehensions and NRC; restricted form of structural recursion [»wongL9_2000]

Subtopic: curry operator up

Quote: for currying, prefer the eval/apply model over push/enter; similar performance with simpler optimization and runtime; push/enter more elegant [»marlS9_2004]
Quote: the push/enter model of the curry operator queries the stack for insufficient arguments; if so, it returns a curried function; otherwise returns a regular function [»marlS9_2004]
Quote: the eval/apply model of the curry operator evaluates the function and then applies it; if there are insuffient arguments, it returns the closure [»marlS9_2004]
QuoteRef: bekiH_1971 ;;156 let add x = lambda y. x+y then (add 3) 4 is 7 (not algol 68)
QuoteRef: stoyJ_1977 ;;45 the curry of add (3,4) id add' such that add'(3)==add3 and add3(4) is curry: ((n X n) ->n) ->(n-> (n-> n)) is all functions of one variable
QuoteRef: stoyJ_1977 ;;46 curry function in lambda notation is curry (f)=2x.xy.f(x,y) the procedure parameter f must exist after the function is invoked
Quote: using combinators, can remove bound variables from an expression; the result is a kind of object code ready for execution [»turnDA1_1979]
Quote: partially instantiate an operator by specifying some of its operands [»wileDS11_1973]

Subtopic: section of a function up

QuoteRef: wileDS11_1973 ;;15 a 'section' is a partially instantiated function eg a(,j)
QuoteRef: earlJ4_1974 ;;35 access a column by a(*,3) producing a function with one less argument

Related Topics up

Topic: formal methods and languages (53 items)

Topic: evaluation in an environment (35 items)
Topic: function call (28 items)
YTopic: functional programming (19 items)
Topic: inheritance by delegation (8 items)
Topic: lambda calculus (16 items)
Topic: no need for variables (13 items)
Topic: object slice
(3 items)

Updated barberCB 5/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.