Feb 2009 -- Due to time pressures, the ongoing development of 'rope' has been suspended temporarily.

ROPE Language Reference - Blocks

ROPE allows groups of actions to be bundled together for execution by action words. These bundles of words are called "blocks" and are specified in the script source using braces ("curly" brackets).

Here's an example of a block:

{ "hello world" println }

When a block is specified in a script, it is not executed, but rather: a reference to it is pushed onto the stack. So the script fragment ..

1 "hello" { "world" println } 10

pushes four items onto the stack: the number 1, the string "hello", a block and the number 10.

These blocks are useful as arguments to action words that control execution. Here's an example:

10 { "hello world" println } repeat

or (to make it look nicer)..

repeat(10 { println( "hello world") } )

This executes the block 10 times - the result being that the string "hello world" is printed to the screen 10 times.

Rope block references can be stored in user registers and invoked later using do, repeat, etc..

put( { "hello world" println } $a )    # - store reference to the block
$a do                                  # - invoke it once
10 $a repeat                           # - invoke it 10 times