Logical operators

The and statement returns True only if all its
expressions evaluate to logically true values. The or
statement returns True if just one or more of its expressions
evaluate to logically true values. Otherwise, these
expressions return False. nand and nor are
analogous to and and or except they will return the
opposite value ("not" and and "not" or).

Isis considers a value to be logically true if it is a non-zero
number, character, or address, or if the value is a procedure or a
non-empty list, or if it is the boolean True. Any other
value, including Null, is considered logically false.

In these constructs, Isis only evaluates the necessary expressions
from left to right to determine the result. For example, if the
first expression in an and statement evaluates to a false
value, any remaining expressions are not evaluated, because their
values would have no effect on the final result.

Read the Isis primer for more
information on these operators and the constructs for conditional
evaluation.

Logical not operator

(not val) # invert logical value of val
This operator inverts a value's logical value, and returns either
True or False. See above for information on what
kinds of values are considered logically true or logically
false.

-> (not False)
True
-> (not 10.1)
False
-> (not 0)
True

Equality operators

(= val val ...) # return True if vals are equal
(!= val val ...) # return True if vals are not equal
(eq? val val ...) # same as = (equal)
(neq? val val ...) # same as != (not equal)
These operators are used for comparing two or more values. For
eq? or =, the result is True if all the values are
identical, and False otherwise. neq? and
!= return the opposite result (effectively the same as
(not (eq? ...)) ). Any type of Isis value is allowed,
including lists, in which case corresponding elements are compared.

Note that the types of the arguments must match in order to be
considered equal (i.e. the integer 3 is not equal to the real number
3.0). If necessary, you can use the type casting operators explained
below to convert arguments to the same type.

Inequality operators

(< val1 val2) # return True if val1 < val2
(> val1 val2) # return True if val1 > val2
(<= val1 val2) # return True if val1 <= val2
(>= val1 val2) # return True if val1 >= val2
(lt? val1 val2) # same as < (less than)
(gt? val1 val2) # same as > (greater than)
(leq? val1 val2) # same as <= (less than or equal to)
(geq? val1 val2) # same as >= (greater than or equal to)
These operators each expect two arguments, which must be integers or
real numbers. The types of the values need not match. The result is
True if the condition holds, and False of not, or
Null if the values are not of the expected type.

Type queries

(integer? val) # return True if val is an integer
(real? val) # return True if val is a real number
(boolean? val) # return True if val is a boolean
(character? val) # return True if val is a character
(address? val) # return True if val is a memory address
(procedure? val) # return True if val is a procedure
(list? val) # return True if val is a list
(integer-list? val) # return True if val is a list of integers
(real-list? val) # return True if val is a list of real numbers
(boolean-list? val) # return True if val is a list of booleans
(character-list? val) # return True if val is a list of characters
(string? val) # same as character-list?
(address-list? val) # return True if val is a list of memory addresses
(procedure-list? val) # return True if val is a list of procedures
(list-list? val) # return True if val is a list of lists
These procedures check the type of a single argument. The list
routines check if the argument is a non-empty list containing only
items of the specified type. The result is either True or
False.

Type casting

(integer val) # convert val to an integer
(real val) # convert val to a real number
(boolean val) # convert val to a boolean
(character val) # convert val to a character
(address val) # convert val to a memory address
(procedure val) # convert val to a procedure
These primitives accept a single value and cast it to the specified
type. Not all casts are valid, in which case an error message will be
printed and Null will be returned.