next up previous contents
Next: Non-core Operations Up: Magnitudes and Numbers Previous: Basic Types   Contents

Basic Operations

All of the normal arithmetic operations (i.e. +, -, *, /) are supported primitively between elements of the same type. Type coercion has to be done entirely in code; no implicit coercions are performed by the virtual machine. However, the standard library includes methods which perform this coercion. The interpreter also transparently provides unlimited-size integers, although the bootstrapped system may not do so implicitly.

The following are the rest of the primitive operations, given with an indication of their "signatures":

Float raisedTo: Float
is simple floating-point exponentiation.
Integer as: Float
extends an integer into a float.
Float as: Integer
truncates a float.
Integer bitOr: Integer
performs bitwise logical OR.
Integer bitXor: Integer
performs bitwise logical XOR.
Integer bitAnd: Integer
performs bitwise logical AND.
Integer bitShift: Integer
performs bitwise logical right-shift (left-shift if negative).
Integer bitNot
performs bitwise logical NOT.
Integer >> Integer
performs logical right-shift.
Integer << Integer
performs logical left-shift.
Integer quo: Integer
returns a quotient (integer division).
Many more useful methods are defined, such as mod:, reciprocal, min:, max:, between:and:, lcm:, and gcd:. Slate also works with Fractions when dividing Integers, keeping them lazily reduced.


next up previous contents
Next: Non-core Operations Up: Magnitudes and Numbers Previous: Basic Types   Contents
Brian Rice 2004-08-24