Carapace

Logic Functions

As with other versions of Lisp, the empty List () is treated as false. Any other value is treated as true.

In all of the functions below:

function name description
&& logical and
|| logical or
! logical not
== test for equality between two objects
!= test for inequality between two objects
> test if one quantity is greater than another
< test if one quantity is less than another
>= test if one quantity is greater than or equal to another
<= test if one quantity is less than or equal to another


&&

Logical and -- this function returns true if all its arguments are true.

Arguments: one or more, of any type

Return type: Object


||

Logical or -- this function returns true if at least one its arguments is true.

Arguments: one or more, of any type

Return type: Object


!

Logical not -- if its argument is true this returns false (ie. the empty List ()). Similarly, if the argument is false (ie. ()) true is returned.

Arguments:

objObject

Return type: Object


==

Test for equality between two objects. Objects of different class are never equal. For objects of the same class, the == method is called and the result returned. If there is no == method, an error is raised.

Arguments:

obj1Object
obj2Object

Return type: Object


!=

Test for in-equality between two objects. Objects of different class are always non-equal. For objects of the same class, the == method is called and the negation of the result returned. If there is no == method, an error is raised.

Arguments:

obj1Object
obj2Object

Return type: Object


>

Test if one quantity is greater than another. Objects of different classes cannot be compared and an error is raised. For objects from the same class, if there is a method called > then this is called, otherwise an error is raised.

The value true is returned if the first object is greater than the second.

Arguments:

obj1Object
obj2Object

Return type: Object


<

Test if one quantity is less than another. Objects of different classes cannot be compared and an error is raised. For objects from the same class, if there is a method called < then this is called, otherwise an error is raised.

The value true is returned if the first object is les than the second, otherwise false is returned.

Arguments:

obj1Object
obj2Object

Return type: Object


>=

Test if one quantity is greater than or equal to another. Objects of different classes cannot be compared and an error is raised. For objects from the same class, the methods > and == are used to determine the result. If these methods do not exist, an error is raised.

The value true is returned if the first object is greater than or equal to the second, otherwise false is returned.

Arguments:

obj1Object
obj2Object

Return type: Object


<=

Test if one quantity is less than or equal to another. Objects of different classes cannot be compared and an error is raised. For objects from the same class, the methods < and == are used to determine the result. If these methods do not exist, an error is raised.

The value true is returned if the first object is less than or equal to the second, otherwise false is returned.

The value true is returned if the first object is les than the second.

Arguments:

obj1Object
obj2Object

Return type: Object


Contents Index Current topic: functions Related topics: objects