1.14 class block

A block object defines a sequence of code objects with a formal parameter list.

On block->forward, the var objects in block<-parameters will be bound to the forwarded arguments (exceeding arguments are bound to @arg1 ...) and the and<-members statements of the block are executed just as with the super-class and.

Example:

?- send(block(new(X, var),
                          message(@pce, write_ln, X)),
                forward,
                'Hello World').

Hello World.
See also
class ?

1.14.1 Instance variables

block <-> parameters: code_vector*
Vector with formal parameters. Assigned (see var->assign) by block->forward.

1.14.2 Send methods

block ->forward: any ...
When a block object is forwarded, it will bind the arguments to the var objects in block<-parameters by position. Possible exceeding arguments are bound to @arg1 ... for compatibility reasons. Next the block is code->execute’d just like the and object.

Example:

?- send(chain(chain(a,b), chain(c,d)), for_all,
                block(new(Sub, var),
                          message(Sub, for_all,
                          message(@pce, write_ln, Sub, @arg1)))).