The Basic Types

The basic types provide much of the functionality you have seen in other languages: integers, reals, strings, bits and boolean objects. In addition, functionality for any object is also provided.

Object

Type Object provides the functionality which is common to all objects. It is an abstract object.

Instance Methods

This section lists methods which are available to all objects.

== anObject:Object
REPLY Boolean

Reply TRUE if me is the same as anObject.

<> anObject:Object
REPLY Boolean

Reply TRUE if me is different from anObject.

type
REPLY Type

Reply with the type of me.

defined
REPLY Boolean

Reply TRUE if me exists (i.e. non-NIL).

undefined
REPLY Boolean

Reply TRUE if me doesn't exist (i.e. NIL).

copy

Reply with a shallow copy of me.

resizeBy n:Integer

Reply with an object expanded or shrunk by n parts.

fullcopy

Reply with a deep copy of me (i.e. all parts and subparts are copies as well).

isKindOf kind:Type
REPLY Boolean

Reply TRUE if me is the same type or supertype as kind.

isInstanceOf aType:Type
REPLY Boolean

Reply TRUE if me is an instance of aType.

asString
REPLY String

Reply with a string which contains the type name of me (e.g. "a Dictionary" or "a Stack").

perform methodName:String with parms:Array

Execute methodName with me as receiver and parms as parameters.

perform methodName:String

Execute methodName with me as receiver.

Boolean

Type Boolean provides functionality for logical operations (i.e. TRUE and FALSE). For additional functionality, refer to Type Object.

Instance Methods

This section lists methods which are available to all instances of Boolean.

and aBoolean:Boolean

Reply TRUE if both me and aBoolean are TRUE.

or aBoolean:Boolean

Reply TRUE if either me or aBoolean are TRUE.

not

Reply TRUE if me is FALSE.

then thenBlock:Block

Execute thenBlock if me is TRUE.

then thenBlock:Block else elseBlock:Block

Execute thenBlock if me is TRUE. Otherwise, execute elseBlock.

whileDo aBlock:Block

Execute aBlock while me is TRUE.

asString
REPLY String

Reply ``True'' if me is TRUE. Otherwise, reply ``False''.

= aBoolean:Boolean

Reply TRUE if me is equal to aBoolean.

<> aBoolean:Boolean

Reply TRUE if me is unequal to aBoolean.

either trueValue:Object or falseValue:Object
REPLY Object

Reply trueValue if me is TRUE. Otherwise, reply falseValue.

Integer

Type Integer implements the functionality associated with whole (i.e. non-decimal) numbers. For additional functionality, refer to Type Object.

Instance Methods

This section lists methods which are available for integer instances.

+ addend:Integer

Reply with the sum of me and addend.

- subtrahend:Integer

Reply with the difference of me and subtrahend.

* multiplicand:Integer

Reply with the product of me and multiplicand.

++

Reply with me incremented.

--

Reply with me decremented.

< anInteger:Integer
REPLY Boolean

Reply TRUE of me is less than anInteger.

<= anInteger:Integer
REPLY Boolean

Reply TRUE of me is less than or equal to anInteger.

> anInteger:Integer
REPLY Boolean

Reply TRUE of me is greater than anInteger.

>= anInteger:Integer
REPLY Boolean

Reply TRUE of me is greater than or equal to anInteger.

<> anInteger:Integer
REPLY Boolean

Reply TRUE of me is not equal to anInteger.

$= anInteger:Integer
REPLY Boolean

Reply TRUE of me is equal to anInteger.

size

Reply 4 (an integer requires 4 bytes).

-

Reply with the negative of me.

mod anInteger:Integer

Reply with the modulus or remainder after me is divided by anInteger.
SIGNAL "Divide by zero"

div anInteger:Integer

Reply with the integer division of me with anInteger.

abs

Reply with the absolute value of me.

truncTo val:Integer

Reply with me truncated to val (e.g. 24 truncTo 10 is 20.)

@ y:Integer
REPLY Point

Reply with a Point which has an x value of me and a y value of y.

asString
REPLY String

Reply with a String representation of me.

asString format:String
REPLY String

Reply with a String representation of me according to format.

asReal
REPLY Real

Reply with a Real representation of me.

asBits
REPLY Bits

Reply with a Bitstring representation of me.

to maximum:Integer do aBlock:Block

Execute aBlock with a block variable ranging from me up to maximum.

to maximum:Integer by increment:Integer do aBlock:Block

Execute aBlock with a block variable ranging from me up to maximum in increments of increment.

downto minimum:Integer do aBlock:Block

Execute aBlock with a block variable ranging from me down to minimum.

downto minimum:Integer by decrement:Integer do aBlock:Block

Execute aBlock with a block variable ranging from me down to minimum in decrements of decrement.

timesDo aBlock:Block

Execute aBlock me times.

gcd b:Integer

Reply with the greatest common divisor of a and b.

isLetter
REPLY Boolean

Reply TRUE if the ASCII value of me is a letter.

isLower
REPLY Boolean

Reply TRUE if the ASCII value of me is a lower case letter.

isUpper
REPLY Boolean

Reply TRUE if the ASCII value of me is an upper case letter.

isDigit
REPLY Boolean

Reply TRUE if the ASCII value of me is a digit.

between min:Integer and max:Integer
REPLY Boolean

Reply TRUE if me is between min and max, inclusive.

max aValue:Integer

Reply with the maximum of me and max.

min aValue:Integer

Reply with the minimum of me and min.

Real

Type Real provides functionality for real or floating point numbers. For additional functionality, refer to Type Object.

Type Methods

This section lists methods which are available when Type Real is the receiver.

pi

Reply with the constant 3.14159265.

e

Reply with the natural log constant 2.71828.

Instance Methods

This section lists methods which are available for real instances.

round
REPLY Integer

Reply with me rounded.

min aValue:Real

Reply with the minimum of me and min.

max aValue:Real

Reply with the minimum of me and min.

+ addend:Real

Reply with the sum of me and addend.

- subtrahend:Real

Reply with the difference of me and subtrahend.

* multiplicand:Real

Reply with the product of me and multiplicand.

/ divisor:Real

Reply with me divided by divisor.

size
REPLY Integer

Reply 4 (a real requires 4 bytes).

< aReal:Real
REPLY Boolean

Reply TRUE if me less than aReal.

<= aReal:Real
REPLY Boolean

Reply TRUE if me less than or equal to aReal.

> aReal:Real
REPLY Boolean

Reply TRUE if me greater than aReal.

>= aReal:Real
REPLY Boolean

Reply TRUE if me greater than or equal to aReal.

<> aReal:Real
REPLY Boolean

Reply TRUE if me not equal to aReal.

$= aReal:Real
REPLY Boolean

Reply TRUE if me equal to aReal.

-

Reply with negative of me.

^ aReal:Real

Reply with me raised to aReal power.

abs

Reply with absolute value of me.

acos

Reply with arccos of me. Me is in radians.

asin

Reply with arcsine of me. Me is in radians.

atan

Reply with arctangent of me. Me is in radians.

cos

Reply with cossine of me. Me is in radians.

sin

Reply with sine of me. Me is in radians.

tan

Reply with tangent of me. Me is in radians.

cosh

Reply with hyperbolic cosine of me. Me is in radians.

sinh

Reply with hyperbolic sine of me. Me is in radians.

tanh

Reply with hyperbolic tangent of me. Me is in radians.

log

Reply with natural log of me.

log10

Reply with log base 10 of me.

sqrt

Reply with square root of me.

exp

Reply with e raised to me power.

asString
REPLY String

Reply with string representation of me.

asString format:String
REPLY String

Reply with string representation of me according to format.

asInteger
REPLY Integer

Reply with integer representation of me (truncated).

String

Type String provides functionality for text strings. For additional functionality, refer to Type Object.

Instance Methods

This section lists methods which are available for String instances.

scan pattern:String from start:Integer
REPLY Integer

Find the position of the first character in me which is in the pattern. Begin search at position start.

isNumber
REPLY Boolean

Reply TRUE if me is a number.

isInteger
REPLY Boolean

Reply TRUE if me is an integer.

asFilename

Strip directory specification from me and return filename. Replace any spaces with underscores.

delete col:Integer

Reply with string which has the character at position col deleted from me.

at loc:Integer insert aChar:Integer

Reply with a string consisting of me with aChar in position loc.

_ aString:String

Reply with the concatenation of me and aString.

from start:Integer

Reply with the substring consisting of the remainder of me starting in position start.

from start:Integer to finish:Integer

Reply with the substring of me starting with position start and ending in position finish.

find pattern:String
REPLY Integer

Reply with the position of pattern in me. Reply with NIL if not found.

findNoCase pattern:String
REPLY Integer

Same as find but use a case-insensitive searc.

at loc:Integer
REPLY Integer

Reply with the character at position loc.

at loc:Integer put aChar:Integer
REPLY Integer

Replace the character at position loc with aChar.

< aString:String
REPLY Boolean

Reply TRUE if me is less than aString.

<= aString:String
REPLY Boolean

Reply TRUE if me is less than or equal to aString.

> aString:String
REPLY Boolean

Reply TRUE if me is greater than aString.

>= aString:String
REPLY Boolean

Reply TRUE if me is greater than or equal to aString.

<> aString:String
REPLY Boolean

Reply TRUE if me is not equal to aString.

$= aString:String
REPLY Boolean

Reply TRUE if me is equal to aString.

=* aString:String
REPLY Boolean

Reply TRUE if me is equal to aString (case-insensitive).

<* aString:String
REPLY Boolean

Reply TRUE if me is less than aString (case-insensitive).

>* aString:String
REPLY Boolean

Reply TRUE if me is greater than aString (case-insensitive).

upper

Reply with me all in upper case.

lower

Reply with me all in lower case.

size
REPLY Integer

Reply with the length of the string in bytes.

capitalize

Reply with me capitalized.

span pattern:String from start:Integer
REPLY Integer

Reply with the number of consecutive characters which are in the pattern string starting with start. For example,

"Dec 17, 1992" span "0123456789" from 5

would reply with 2, matching the number 17 starting in column 5.

center width:Integer

Reply with a string which is centered within width characters.

asInteger
REPLY Integer

Reply with integer representation of me.

asString

Reply with me. This method does nothing but is provided for consistency with other types.

asString format:String

Reply with a string consisting of me formatted using format.

asReal
REPLY Real

Reply with a real representation of me.

asType
REPLY Type

Reply with the type which has the name of me.

asArray
REPLY Array

Reply with an array of strings, each string being a line which was terminated by a newline character in me.

asBits
REPLY Bits

Reply with a bitstring representation of me.

asBoolean
REPLY Boolean

Reply with TRUE if me is "true" or "t", or FALSE if me is "false" or "f".
SIGNAL "Expected TRUE or FALSE"

assemble
REPLY Object

Reply with the object representated by me. The receiver must be in object format as specified in the Assembler manual.

compile
REPLY Object

Reply with the object represented by me. The receiver must be in the source code format.

compileType
REPLY Type

Reply with the type represented by me.

compileTypeMethodOf tname:String
REPLY Method

Reply with the method represented by me which is a type method of type tname.

compileInstanceMethodOf tname:String
REPLY Method

Reply with the method represented by me which is an instance method of type tname.

format

Reply with a reformatted method of me.

formatTypeMethodOf tname:String

Reply with a reformatted method of me.

formatInstanceMethodOf tname:String

Reply with a reformatted method of me.

hash
REPLY Integer

Reply with an integer which is a hashed version of me. While the integer is not guaranteed to be unique, it can be considered so for most applications. This is the same function which is used by the compiler to generate symbols of the form #string.

reFormat

Reformat me, especially escape characters.

wordsDelimitedBy delim:String
REPLY Array

Reply with an array of words in me using the characters in delim as delimiting characters for the words.

do aBlock:Block

Execute aBlock for each character in a string. The block variable is set to this character.

asPoint
REPLY Point

Converts me to a point. The receiver must be in the form of "x,y", "x@y" or "x y".
SIGNAL "'str' not in 'x,y' format".

Bits

Type Bits provides the basic functionality of bit strings. For additional functionality, refer to Type Object.

Type Methods

This section lists methods available when Type Bits is receiver.

new size:Integer

Reply with a bit string which will hold at least size bits.

Instance Methods

This section lists methods which are available to bit strings.

and aBits:Bits

Reply with me such that the only TRUE bits are in the original me and aBits.

or aBits:Bits

Reply with me such that the TRUE bits are in the original me or aBits.

not

Reply with me such that the TRUE bits in me are now FALSE and vice versa.

exor aBits:Bits

Reply with me such that the TRUE bits in me were in the original me or aBits but not both.

<< n:Integer

Left shift me by n bits.

>> n:Integer

Right sihft me by n bits.

at index:Integer
REPLY Boolean

Reply with the value of the bit at position index.

at index:Integer put value:Boolean

Set the bit at position index in me to value.

= aBits:Bits
REPLY Boolean

Reply TRUE if both me and aBits have the same bits set.

count
REPLY Integer

Reply with a count of TRUE bits in me.

asString
REPLY String

Reply with a string representation of the bit string (octal format).

asInteger
REPLY Integer

Reply with an integer representation of me. Me must contain less than 32 bits.

size
REPLY Integer

Reply with number of bytes (8 * bits) in me.