Skip to content

Application

Bill Hails edited this page Oct 21, 2018 · 7 revisions

A function that takes an argument and returns a function that takes another argument can be called in one step. This is somewhat the opposite of Currying:

fn adder(x) {
    fn (y) { x + y }
}

adder(2, 3); // 5

This would be totally crazy without a separate type checker which deduces the type of adder to be int -> int -> int before allowing this (see Type Notation for a discussion of ->).

Up: Functions

Next: Composite Functions

Clone this wiki locally