Lecture 16 - October 18, 2007

 

courtesy of Chad Parker

Here is a link to the pdf version of the Snobol Language Greenbook.
ftp://ftp.cs.arizona.edu/snobol/gb.pdf

If that for some reason does not work, the link is located on the site

http://www.snobol4.org/

It is under the heading:
SNOBOL related pages
Language references and programming

The text of the link is PDF of "Greenbook" (Snobol Programming Language)!!!

 

 

To declare an array    variableName = array (numberOfElements) 

            Or                variableName = array (numberOfElements, InitialValueOfEachElement)

 

To access an array element use  variableName<index>

 

Do not leave a space between a function name and the parentheses containing its arguments.

 

The function LT has two arguments:  LT(valueBeingChecked,valueBeingCheckedAgainst)

 

Functions are defined using the keyword DEFINE

Function definitions must precede the statement that calls them

Although the function body precedes the calling body, it should be skipped over and not executed until it is called.  See example 

 

 

 

 

Numerical Predicates - primitive functions –

These have names just like those in FORTRAN but not delimited by periods and take two arguments – relational operations

LT

LE

EQ

NE

GE

GT

 

INTEGER  -- tests whether something is an integer

 

IDENT -- tests whether arguments are truly identical

DIFFER -- tests whether arguments are different

 

LGT  -- lexically greater than

 

SIZE -- determines the length of a string

 

REPLACE -- will do a one-for-one character replacement in a string

 

TRIM -- argument must be a string or an integer

&TRIM -- deletes trailing blank

 

DUPL -- has two arguments, a string and an integer

REMDR -- has two integer arguments  (remainder when first is divided by second)

 

DATE -- has no arguments  DATE()

TIME -- has no arguments  TIME()

 

There are others… look in the Green book…