Download ALisp User`s Guide

Transcript
System Functions and Variables
4.4
Logical Functions
Function
Type
Description
(AND X...)
*SPECIAL
Evaluate the forms X... and return NIL when the first form evaluated to NIL
is encountered. If no form evaluates to NIL the value of the last form is
returned.
(COMPARE X Y)
SUBR
Compare order of two objects. Return 0 if they are equal, -1 if less, and 1 if
greater.
(EQ X Y)
*SUBR
Test if X and Y have the same address.
(EQUAL X Y)
*SUBR
Test if objects X and Y are equivalent [1]. Notice that, in difference to
CommonLisp, non- arrays are equal if all their elements are equal.
(NEQ X Y)
*SUBR
(NOT (EQ X Y))
(OR X...)
*SPECIAL
Evaluate the forms X... until some form does not evaluate to NIL. Return the
value of that form.
(NOT X)
*SUBR
True if X is NIL; same as NULL.
(EVERY FN ARG...)
*MACRO
Return T if FN returns non-nil result when applied on every element in the
lists ARG... in parallel.
(SOME FN L...)
*MACRO
Apply FN on each of the elements in the lists L... in parallel. If FN returns
non-nil value for some element then SOME will return T, otherwise NIL.
4.5
Arithmetic Functions
Function
Type
Description
(+ X...)
*SUBR
Add the numbers X...
(- X Y)
*LAMBDA Subtract Y from X.
(1+ X)
*MACRO
Add one to X which can be both integer and real.
(1++ X)
MACRO
Increment the variable X.
(1- X)
*MACRO
Subtract one from X which can be both integer and real.
(1-- X)
MACRO
Decrement the variable X.
(* X...)
*SUBR
Multiply the numbers X...
(/ X Y)
*SUBR
Divide X with Y.
(< X Y)
*SUBR
True if the number X is less than Y.
(<= X Y)
*LAMBDA True if the number X is less than or equal to Y.
(= X Y)
*SUBR
Tests if two numbers are the same. E.g. (= 1 1.0) => T, while (EQUAL 1 1.0)
=> NIL
(> X Y)
*LAMBDA True if the number X is greater than Y.
(>= X Y)
*LAMBDA True if the number X is greater than or equal to Y
(INTEGERP X)
*SUBR
True if X is an integer.
(MAX X Y)
*SUBR
Return the largest of the numbers X and Y. Exactly two arguments, unlike
CommonLisp standard.
(MIN X Y)
*SUBR
Return the smallest of the numbers X and Y. Exactly two arguments, unlike
CommonLisp standard.
(MINUS X)
*SUBR
Negate the number X.
(MOD X Y)
*SUBR
Return the remainder when dividing X with Y. X and Y can be integers or
floating point numbers.
14