<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN">
<book>

<bookinfo><date>2002-03-28</date><title>Ripley Users Guide</title></bookinfo>

<toc></toc>

<chapter>
<title>Introduction</title>
<para>
This guide is intended to provide a simple introduction to the syntax and structure
of programs written in Ripley.  It's important to note, however, that Ripley is an
experimental implementation of a language, and not a language intended for production code.
</para>
<para>
Ripley is an implementation of a variant of 
<ulink url="http://dir.yahoo.com/Computers_and_Internet/Programming_and_Development/Languages/Forth/">Forth</ulink> /
<ulink url="http://dir.yahoo.com/Computers_and_Internet/Programming_and_Development/Languages/PostScript/">Postscript</ulink> in
<ulink url="http://www.ruby-lang.org/en/">Ruby</ulink>.
</para>
<para>
The User's Guide is divided into chapters which follow how you might learn the language if you just started
with an editor and the interpreter. As you might expect, the first thing to learn is how to
<link linkend=ch02>"Printing things out"</link>, so that you can see what you are doing.  After that
you might want to learn how to <link linkend=ch03>"Do some math"</link>.  This section will also teach you about
the basic nature of Ripley, about the operand and execution stacks.
</para>
<para>
After print stuff out and doing some math, you will probably want to create some 
<link linkend=ch04>"Variables"</link>.
Next, we modularize with <link linkend=ch06>"Making New Functions"</link>.
After learning how to store stuff in memory and modularize, then next step would be
to make decisions based on it, you will learn how to do that in <link linkend=ch05>"Ifs and Elses"</link>.
Finally we loop and iterate over arrays using
<link linkend=ch07>"Loops and stuff"</link>.
</para>
</chapter>

<chapter id=ch02>
<title>Print things out</title>
<para>
The first thing you need to do to start playing with any language is to find a way to print
things out.  An example of the use of the 'print' operator, which prints the item at the top of the
stack out to the standard output, is shown below:
</para>

<example><title>Printing Hello World</title>
<para>Program Listing</para>
<programlisting>"Hi World!\n" print</programlisting>
<para>Program Output</para>
<screen>Hi World!</screen>
</example>

<para>But how do we run this?  There are two methods; the first is to use Ripley in an interactive
mode.  Where everything you type is immediately evaluated by Ripley.  The example below shows how
to do this:
</para>

<example><title>Using Ripley Interactively</title>
<para>Command Line</para>
<programlisting>./ripley -f examples/terminal.ripley</programlisting>
<para>Program Output</para>
<screen>Interpreter for Ripley, version 0.1
Ripley (blank line to exit) > </screen>
</example>

<para>The next method is to create a new text file with your Ripley commands, and then to use Ripley
to execute it directly.  The below shows how to do this:
</para>

<example><title>Using Ripley With A File</title>
<para>File: test.ripley</para>
<programlisting>"Hello World!" print</programlisting>
<para>Command Line</para>
<programlisting>./ripley -f test.ripley</programlisting>
<para>Program Output</para>
<screen>Hello World!</screen>
</example>

</chapter>

<chapter id=ch03>
<title>Do some math</title>

<para>The next thing to learn is how to do some simple math, for example, write a program to print the
result of 1+2.  Here is an example of how to 1 and 2 together and to print the result:</para>

<example><title>Evaluating 1 + 2</title>
<para>Program Listing</para>
<programlisting>1 2 add print</programlisting>
<para>Program Output</para>
<screen>3.0</screen>
</example>

<para>What does that mean?  And why does it work?</para>

<sect1><title>More about stacks</title>

<para>To understand why this works you need to understand the system of stack evaluation that is at the 
core of Ripley.  Ripley has two stacks, the execution stack and the operand stack.  Both stacks start empty.
When a program is evaluated it is placed into the execution stack.  So in our example the stacks start as:</para>

<screen>
Operand Stack:
Execution Stack: 1.0 2.0 add print
</screen>

<para>The interpreter gets the first item on the execution stack and executes it. In this case it's a simple value
'1'.  In the case of simple values it pushes the value onto the operand stack.  So after the first evaluation
the stacks look like this:</para>

<screen>
Operand Stack: 1.0
Execution Stack: 2.0 add print
</screen>

<para>The same thing happens with the '2'.</para>

<screen>
Operand Stack: 2.0 1.0
Execution Stack: add print
</screen>

<para>The next item is a literal 'add'.  The interpreter looks literals up in the dictionaries and then
executes the result.  'add' is a registered operand in the system dictionary. (More about dictionaries in a
bit.)  The 'add' operand pops two elements off the operand stack, adds them together pushes the result
back onto the operand stack.  After the evaluation of 'add' the stacks look like this:</para>

<screen>
Operand Stack: 3.0
Execution Stack: print
</screen>

<para>Ripley then evaluates the 'print' literal, which is another operator found in the system dictionary.
Print pops the operand stack and prints the result out to STDOUT.  It does not push anything back onto the
operand stack.  After '3' is printed out by the 'print' operator the stacks look like this:</para>

<screen>
Operand Stack: 
Execution Stack: 
</screen>

<para>Next we do a little more math.</para>

</sect1>
<sect1><title>A little more math</title>

<para>The next thing to lear are the other math primitives; sub, mul and div.  These are the operands for
subtract, multiply, and divide.  They all work like add, taking two operands from the operand stack, applying
a transform (adding, subtracting, multiplying or dividing) and pushing the result back onto the operand
stack.</para>

<para>Here is an example subtraction:</para>
<example><title>Subtracting 1 for 2</title>
<para>Program Listing</para>
<programlisting>2 1 sub print</programlisting>
<para>Program Output</para>
<screen>1.0</screen>
</example>

<para>An example multiplication:</para>
<example><title>Multiplying 2 by 10</title>
<para>Program Listing</para>
<programlisting>2 10 mul print</programlisting>
<para>Program Output</para>
<screen>20.0</screen>
</example>

<para>An example division:</para>
<example><title>Dividing 10 by 5</title>
<para>Program Listing</para>
<programlisting>10 5 div print</programlisting>
<para>Program Output</para>
<screen>2.0</screen>
</example>

<para>How about more complex formulae? Well, it's really a matter of creating a sequence of operands
that manipulate the stack correctly. For example, how about (1+2)*10:</para>

<example><title>Evaluating (1+2)*10</title>
<para>Program Listing</para>
<programlisting>1 2 add 10 mul print</programlisting>
<para>Program Output</para>
<screen>30.0</screen>
</example>

<para>Is it as easy as (1+2)*10, maybe not, but it is a sytem capable of building an arbitrary simple
equation.</para>

</sect1>
</chapter>

<chapter id=ch04>
<title>Variables</title>

<para>There are only a few simple types of variables in the Ripley system.</para>

<table frame=none><title>Ripley Variable Types</title>
<tgroup cols=2>
<colspec colwidth=2in />
<colspec colwidth=5in />
<tbody>
<row><entry>Simple Types</entry><entry>These are numbers or strings.</entry></row>
<row><entry>Literals</entry><entry>These are strings that are going to be evaluated against the dictionary stack as soon as they are executed.</entry></row>
<row><entry>Arrays</entry><entry>An array of items.  It can include other arrays or dictionaries.</entry></row>
<row><entry>Excutable Arrays</entry><entry>This is an array of elements that is to be loaded into the execution stack and evaluated.  It is the Ripley equivalent of a function.</entry></row>
<row><entry>Dictionary</entry><entry>An array of key value pairs that can be indexed by key.</entry></row>
</tbody>
</tgroup>
</table>

<para>The variable types are discussed in more details, with examples, in the following sections.</para>

<sect1><title>More About the Different Variable Types</title>

<para>The next sections talk in detail about each of the different variable types.</para>

<sect2><title>Simple Types</title>

<para>Simple types are strings or numbers that are pushed onto the operand stack when executed.  Some examples
are:</para>

<table frame=none><title>Example Simple Types</title>
<tgroup cols=2>
<colspec colwidth=2in />
<colspec colwidth=5in />
<tbody>
<row><entry>2</entry><entry>The numeric value 2.0.</entry></row>
<row><entry>5.6</entry><entry>The numeric value 5.6.</entry></row>
<row><entry>"string value"</entry><entry>The string "string value".</entry></row>
<row><entry>"string\nvalue"</entry><entry>The string "string value" with a carraige return between the 'string' and 'value' words.</entry></row>
<row><entry>/stringValue</entry><entry>The string 'stringValue'.  This is equivalent to "stringValue".</entry></row>
</tbody>
</tgroup>
</table>

</sect2>
<sect2><title>Literals</title>

<para>These are string values (items that start with a alpha value) which are evaluated against the dictionary stack
when they are executed.</para>

<para>What is the dictionary stack?  The Ripley interpreter starts up with two dictionary predefined.  The first
is the system dictionary, which contains all of the critical operands and contants values (add, mul, div,
def, ripley_version, true, false, etc.)  And the user dictionary which is initially empty.  The dictionary stack
is the set of both the user and system dictionaries.  When a literal lookup occurs the user stack is checked
first, then the system stack is evaluated.</para>

</sect2>
<sect2><title>Arrays</title>
<para>Arrays are sets of variables surrounded by brackets.  An example is:</para>

<example><title>Array Example 1</title>
<programlisting>[ 1 2 3 ]</programlisting>
</example>
<para>This is an array of the values 1.0, 2.0 and 3.0.</para>

<example><title>Array Example 2</title>
<programlisting>[ 1 "hi" 3 ]</programlisting>
</example>
<para>This is an array of the values 1.0, "hi" and 3.0.</para>

</sect2>
<sect2><title>Executable Arrays</title>
<para>These are just like arrays, but they are delimited with curly braces.  The important difference to the
Ripley system is that when they are evaluated they are pushed element by element into the execution stack.  Which
is then interpreter by the Ripley execution engine.  This becomes very important for Functions, which we get into 
in the next section.  Examples of Executable Arrays are in the "Making New Functions" chapter.</para>
</sect2>
<sect2><title>Dictionaries</title>
<para>Dictionaries are arrays that are indexed by a unique key instead of by a ascending numeric sequence.
Unlike Postscript, which has special functions to build dictionaries, you can define dictionaries using 
the less than and greater than symbols in Ripley.  An example is:</para>

<example><title>Dictionary Example</title>
<programlisting>&lt; "first_name" "Jack" "last_name" "Herrington" &gt;</programlisting>
</example>
<para>This creates a dictionary with two key value pairs.  If the dictionary is accessed with
"first_name" you would get "Jack" and "last_name" would get you "Herrington".</para>

</sect2>

</sect1>
<sect1><title>Naming Variables in the User Dictionary</title>
<para>You can store any value type as an element in the user dictionary using the 'def' command. In the example
below we will rewrite the '1+2' example from before using named variables.</para>

<example><title>1+2 using named variables</title>
<programlisting>/a 1 def
/b 2 def
a b add print
</programlisting>
</example>

<para>The value 1.0 is assigned to 'a' in the user dictionary using the def command, which takes a string
and a value as operands.  The value 2.0 to 'b'.  Then the values are recalled using 'a' and 'b' as literals.
Because 'a' is used as a literal it is reference in the user dictionary when it is executed and the value
found in the user (or system) dictionary is then executed.  In this case the value 1.0 is executed, which, because
it is a simple value, is pushed onto the operand stack.</para>

</sect1>

</chapter>

<chapter id=ch06>
<title>Making New Functions</title>
<para>Function in Ripley are just executable arrays that have been assigned as elements in the user dictionary.
To define a function we use an executable array and the 'def' operator that we used in the variable
assignment section from before.  Here is an example where I create a function that prints "Hello World!":</para>

<example><title>Hello World function</title>
<programlisting>/hello { "Hello World!" print } def
hello
</programlisting>
</example>

<para>Arguments to functions are implemented using the operand stack, just like every other Ripley function.
Here is an example add10 function, which adds 10 to whatever you give it:</para>

<example><title>Add 10 function</title>
<programlisting>/add10 { 10 add } def
20 add10 print
100 add10 print
</programlisting>
</example>

</chapter>

<chapter id=ch05>
<title>Ifs and Elses</title>
<para>Understanding how conditionals are implemented in Ripley requires knowing how executable arrays work, and 
the system dictionary values of true and false.</para>
<para>First is the 'if' operand, which takes two operands.  The first is a boolean value, then second is an
executable array.  For example, this code block will always execute:</para>

<example><title>Always true conditional</title>
<programlisting>true { "Always prints" print } if</programlisting>
</example>

<para>The next example never prints because the boolean is negative.</para>

<example><title>Always false conditional</title>
<programlisting>false { "Never prints" print } if</programlisting>
</example>

<para>Well, that's great, if you want a conditional that is not conditional.  So we need some comparison operators.
Which is where eq, lt, le, gt, and ge come in handy.  These functions take two operands off the operand stack,
then push one boolean value back onto the operand stack.  Here is an example of a function that prints
a string if the value 'passed' in on the stack is greater than ten.</para>

<example><title>Greater than ten printer</title>
<programlisting>/geTenPrinter { 10 gt { "Greater than 10\n" print } if } def
5 geTenPrinter
15 geTenPrinter
</programlisting>
</example>

<para>If we have an if then else type of syntax then we could implement a printer that prints out one
string if it's greater than 10 and another if it's less.  This is where the ifelse operator comes in handy.
It takes three operands off the operand stack; the first is a boolean, the next an executable array that is
executed if the boolean is true, and the next is an executable array that is executed if the value
is false.  (An easy way to remember which one is which is by matching the first executable array with
the 'if' portion of the name and the second executable array with the 'else' portion.)  Here is 
an example of the geTenPrint implemented using 'ifelse'.</para>

<example><title>Greater than ten printer (ifelse version)</title>
<programlisting>/geTenPrinter { 10 gt { "Greater than 10\n" } { "Less than 10\n" } ifelse print } def
5 geTenPrinter
15 geTenPrinter
</programlisting>
</example>

</chapter>

<chapter id=ch07>
<title>Loops and such</title>
<para>The last thing you need for minimal language completeness is some sort of looping construct.
Ripley comes with two.  The first is a 'loop' operand that continues executing an executable array until
the 'exit' operator is called.  The 'exit' operator sets a flag which is caught by the while when it is
next executed and the while halts. Below is an example of the loop operator:</para>

<example><title>Counter to 10</title>
<programlisting>/count 0 def
{ /count count 1 add def 
 "count = " print
 count print
 "\n" print
 count 10 gt
 { exit } if
} loop</programlisting></example>

<para>In this example we use the 'loop' operand in concert with the 'if' and 'exit' operators to count
from 0 to 10 and to print the values as we count up.</para>

<para>The other looping operator is the forall operator which iterates over an array, adding each
item to the operand stack each time through, then executing an executable array.  Below is an example
of using the 'forall' operator to print out an array:</para>

<example><title>Walking an array with forall</title>
<programlisting>[ 1 2 3 ] { print "\n" print } forall</programlisting></example>

<para>Forall takes two operands off the operand stack.  The first is the array to iterate over, the
second is an executable array to invoke with each item.  As each item is iterated over the item is
pushed onto the operand stack.  That's why the first 'print' works in the executable array in the previous
example.</para>

<para>The 'exit' operand can also be used within a 'forall' construct.  In the example below the code
iterates through the array but breaks if the value is above 50:</para>

<example><title>Using exit within forall</title>
<programlisting>[ 1 2 3 10 20 30 100 200 300 ] {
 dup
 50 gt
 { exit } { print "\n" print } ifelse
} forall</programlisting></example>

</chapter>

<appendix><title>Ripley Operands</title>
<para>The following sections go into detail about the Ripley operands.</para>

<!-- Operators start here -->

<sect1><title>add</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number add number
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns the second operand added to the first operand.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>3.0 2.0 add 5.0</programlisting> 
<programlisting>4.0 2.0 add 6.0</programlisting> 
</sect1>

<sect1><title>aload</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
array aload any1 anyn array
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Pushes all of the items on the array onto the operand stack, then pushes the array onto the operand stack.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>astore</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any1 anyn astore array
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Stores all of the operand stack elements into an array.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>clear</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
none clear none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Clears the operand stack.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>count</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
none count number
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns the length of the operand stack.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>1.0 2.0 3.0 count 3.0 3.0 2.0 1.0</programlisting> 
</sect1>

<sect1><title>debug_dump</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
none debug_dump none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Dumps debugging information to STDOUT.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>debug_opstack</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
none debug_opstack none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Dumps operand stack debugging information to STDOUT.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>def</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
string any def none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Sets or adds an entry in the user diction for the name to the value specified.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>div</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number div number
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns the first operand divided by the second.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>3.0 2.0 div 1.5</programlisting> 
<programlisting>4.0 2.0 div 2.0</programlisting> 
</sect1>

<sect1><title>dump</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any dump string
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Converts the top operand into a string and pushes it onto the stack.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>dup</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any dup any any
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Duplicates the top item on the stack.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>1.0 dup 1.0 1.0</programlisting> 
<programlisting>&quot;b&quot; dup &quot;b&quot; &quot;b&quot;</programlisting> 
</sect1>

<sect1><title>eq</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any any eq bool
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns true if the two objects are identical.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>exch</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any any exch any any
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Swaps the top two operands.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>exec</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any exec none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Executes the first object on the operand stack.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>exit</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
none exit none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Sets the exit flag on the current loop.  Looping will terminate when the execution reaches the loop point.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>false</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>

</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>The 'false' constant.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>forall</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
array proc forall none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Iterates all of the items of an array against an executable array.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>ge</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number ge bool
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns true if the first operand is greater than or equal to the second.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>get</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
array index get anydict key get any
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>For arrays this gets the item at the index specified and puts it on the stack. For keys this gets the item at the specified key.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>gets</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
none gets string
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Gets a string from STDIN and pushes it on the stack.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>gt</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number gt bool
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns true if the first operand is greater than the second.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>if</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
bool proc if none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Runs the executable array if the boolean is true.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>ifelse</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
bool proc proc ifelse none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>If the boolean is true then the positive executable array is invoked, otherwise the negative executable array is invoked.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>keys</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
dict keys array
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Pushes an array of the keys of the hash into the operand stack.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>le</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number le bool
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns true if the first operand is less than or equal to the second.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>length</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
array length lengthstring length lengthdict length key_count
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Pushes the length of the object onto the operand stack.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>loop</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
proc loop none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Loops around an executable array until exit is invoked.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>lt</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number lt bool
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns true if the first operand is less than the second.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>mul</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number mul number
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns the first operand multiplied by the second.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>3.0 2.0 mul 6.0</programlisting> 
<programlisting>4.0 2.0 mul 8.0</programlisting> 
</sect1>

<sect1><title>not</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
bool not none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Inverts the top operand.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>pop</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any pop none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Pops the first item off the stack.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>1.0 2.0 pop 1.0</programlisting> 
<programlisting>1.0 2.0 3.0 pop 2.0 1.0</programlisting> 
</sect1>

<sect1><title>print</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any print none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Prints the top operand to STDOUT.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>put</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
dict key value put -array index value put -
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Sets the value at the specified index (or key) to the specified value.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>ripley_version</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>

</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>The version number of the Ripley Interpreter.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>roll</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
any1 anyn n j roll any1 anyn
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Rolls 'n' items on the stack in 'd' direction.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>&quot;a&quot; &quot;b&quot; &quot;c&quot; 3 -1 roll &quot;b&quot; &quot;c&quot; &quot;a&quot;</programlisting> 
<programlisting>&quot;a&quot; &quot;b&quot; &quot;c&quot; 3 1 roll &quot;c&quot; &quot;a&quot; &quot;b&quot;</programlisting> 
<programlisting>&quot;a&quot; &quot;b&quot; &quot;c&quot; 3 0 roll &quot;a&quot; &quot;b&quot; &quot;c&quot;</programlisting> 
</sect1>

<sect1><title>sub</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
number number sub number
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Returns the second operand subtracted from the first operand.</para>
<para><emphasis>Examples</emphasis></para>   
<programlisting>3.0 2.0 sub 1.0</programlisting> 
<programlisting>4.0 2.0 sub 2.0</programlisting> 
</sect1>

<sect1><title>token</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>
string token none
</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>Takes a string as input and parses the Ripley code in the string. The resulting output is put into the operand stack as an executable array.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<sect1><title>true</title>
<para><emphasis>Signature</emphasis></para>
<funcsynopsis>
<funcsynopsisinfo>

</funcsynopsisinfo>
</funcsynopsis>
<para><emphasis>Description</emphasis></para>
<para>The 'true' constant.</para>
<para><emphasis>Examples</emphasis></para>   

</sect1>

<!-- Operators end here -->

</appendix>


</book>
