Feather::Lambda

Last updated: 8th July 1999 at 10:50 BST

Syntax

feather::lambda <args> <body>
Creates and returns a lambda command object. The meaning of the args and body arguments are the same as for [proc].

Description

A lambda object is simply an unnamed procedure and is very useful if you want a procedure but do not want to worry about what name to give it.

Examples

% set square [feather::lambda {x} {expr {$x * $x}}]
<feather::lambda(1,1)>
% $square 12
144

% proc compose {f g} {
    # returns a function equivalent to [$f [$g $x]]
    return [feather::curry [feather::lambda {f g x} {$f [$g $x]}] $f $g]
}
% 

See also

curry


[email protected]