Example 1:
> procedure add(X,Y) { return X + Y; };
> succ = bind(add,X,1);
> succ(5);
6
> succ;
proc(Y)
{
nop;
return (proc(X, Y)
{
nop;
return (X) + (Y);
})(1, Y);
}
Example 2:
> procedure add(X,Y) { return X + Y; };
> succ = bind(add,X,1);
> five = bind(succ,Y,4);
> five();
5
> five;
proc()
{
nop;
return (proc(Y)
{
nop;
return (proc(X, Y)
{
nop;
return (X) + (Y);
})(1, Y);
})(4);
}
Example 3:
> verbosity = 1!;
> procedure add(X,Y) { return X + Y; };
> foo = bind(add,R,1);
Warning: the given procedure has no argument named "R". The procedure is returned unchanged.
> foo;
proc(X, Y)
{
nop;
return (X) + (Y);
}