Previous Next Chapter

Returns the minimum of the supplied arguments, all of which must be numeric. At least two parameters must be supplied. For example:

MIN()

NIM(number,number[,number,...])

SAY MIN(2.1,3,-1) -> -1

OPEN()

OPEN(file,filename[,'APPEND'|'READ'|'WRITE'])

Opens an external file for the specified operation. The file argument defines the logical name by which the file will be referenced. The filename is the external name of he file and may include device and directory specifications. The function returns a Boolean value that indicates whether the operation was successful. There is no limit to the number of files that can be open simultaneously, and all open files are closed automatically when the program exits. See also CLOSE(), READ(), and WRITE(). For example:

SAY OPEN(`MyCon', `CON:160/50/320/100/MyCON/cds') P-> 1
SAY OPEN(`outfile', `ram:temp', `W') -> 1

Overlays the new string onto the old string beginning at the specified start position, which must be positive. The default starting position is 1. The new string is truncated or padded to the specified length as required, using the supplied pad character or blanks. If the start position is beyond the end of the old string, the old string is padded on the right. For example:

OVERLAY()

OVERLAY(new,old[,start][,length][,pad])

SAY OVERLAY(`bb', `abcd') -> bbcd
SAY OVERLAY(`4', `123',5,5, `-`) -> 123-4----

Searches for the first occurrence of the pattern argument in the string argument, beginning at the position specified by the start argument. The default starting position is 1. The value is the index of the matched string or 0 if the pattern wasn't found. For example:

POS()

POS(pattern,string[,start])

SAY POS(`23', `123234') -> 2
SAY POS(`77', `123234') -> 0
SAY POS(`23', `123234',3) -> 4

This function allows a program to change various attributes relating to the system environment within which the program executes. The option argument is a keyword that specifies an environmental attribute. The value argument supplies the new attribute value to be installed. The value returned by the function depends on the attribute selected. Some attributes return the previous value installed, while others may simply set a Boolean success flag.

PRAGMA()

PRAGMA(option[,value])

The currently defined option keywords are:

DIRECTORY

PRIORITY

ID

STACK

The currently implemented options are:

PRAGMA(`W',{`NULL'|' WORKBENCH'})

PRAGMA(`*'[,name])

SAY PRAGMA(`D', `DF0:C') -> Extras
SAY PRAGMA(`D', `DF1:C') -> Workbench:C
SAY PRAGMA(`PRIORITY', -5) -> 0
SAY PRAGMA(`ID') -> 00221ABC
CALL PRAGMA `*',STDOUT
SY PRAGMA("STACK",8092) -> 4000

Returns a pseudo-random integer in the interval specified by the min and max arguments. The default minimum value is 0 and the default maximum value is 999. The interval max-min must be less than or equal to 1000. If a greater range of random integers is required, the values from the RANDU() function can be suitably scaled and translated. The seed argument can be supplied to initialize the internal state of the random number generator. See also RANDU(). For example:

RANDOM()

RANDOM([MIN][,MAX][,seed])

thisroll = RANDOM(1,6) /*Might be 1*/
nextroll = RANDOM(1,6) /*Might be snake eyes*/

Returns a uniformly-distributed, pseudo-random number between 0 and 1. The number of digits of precision in the result is always equal to the current Numeric Digits setting. With the choice of suitable scaling and translation values, RANDU() can be used to generate pseudo-random numbers on an arbitrary interval.

RANDU()

RANDU([seed])

The optional integer seed argument is used to initialize the internal state of the random number generator. See also RANDOM(). For example:

firsttry = RANDU() /*0.371902021?*/
NUMERIC DIGITS 3
tryagain = RANDU () /*0.873?*/

Reads the specified number of characters from the given logical file into a string. The length of the returned string is the actual number of characters read and may be less than the requested length if, for example, the end-of-file was reached. See also READLN(). For example:

READCH()

READCH(file,length)

instring = READCH(`input',10)

Reads characters from the given logical file into a string until a newline character is found. The returned string does not include the newline. See also READCH(). For example:

READLN()

READLN(file)

instring = READLN(`MyFile')

Removes an entry with the given name from the Library List maintained by the resident process. The Boolean return is 1 if the entry was found and successfully removed. This function does not make a distinction between function libraries and function hosts, but simply removes a named entry. See also ADDLIB(). For example:

REMLIB()

REMLIB(name)

SAY REMLIB(`MyLibrary.library') -> 1

Reverses the sequence of characters in the string. For example:

REVERSE()

REVERSE(string)

SAY REVERSE(`?ton yhw') -> why not?

Returns the rightmost substring in the given string argument with the specified length. If the substring is shorter than the requested length, it is padded on the left with the supplied pad character or blanks. For example:

RIGHT()

RIGHT(string,length[,pad])

SAY RIGHT(`123456',4) -> 3456
SAY RIGHT(`123456',8, `+') -> ++123456

SEEK()

SEEK(file,offset[,'BEHIN'|'CURRENT'|'END'])

Moves to a new position in the given logical file, specified as an offset from an anchor position. The default anchor is Current. The returned value is the new position relative to the start of the file. For example:

SAY SEEK(`input',10,'B') -> 10
SAY SEEK(`input',0,E') -> 356 /*file length*/

Adds a name-value pair to the Clip List maintained by the resident process. If an entry of the same name already exists, its value is updated to the supplied value string. Entries may be removed by specifying a null value. The function returns a Boolean value that indicates whether the operation was successful. For example:

Top Previous Next Chapter