AutoLISP Internal Functions

Mar 05

Functions as listed in the “AutoLISP Reference” Manual, are of two types: Internal and User Defined

Internal, or predefined functions, are those that are resident within AutoLISP such as the ones listed in the “Reference” Manual. Many common Math functions that you may already be familiar with are included in these functions:

(+) add
(-) subtract
(*) multiple
(/) divide

and the logical operators:

(<) less than
(>) greater than
(=) equal to
(/=) not equal to

are a part of the many internal functions. These functions are called simply by giving their name as the first element of a list, with the arguments to that function following. Consider the next list:

(+ 1 2 3)

Here, the first element of the list (+), is an internal function that will evaluate the arguments (1 2 3) that follow, and return 6 as the result. Functions will always return a result.

Command: (+ (* 3 2) (/ 12 4) 2)
Lisp Returns: 11

As you can see from this example, a list may contain other lists with functions as their first element. Since lists are made up of elements, lists themselves can be elements of other lists. This is referred to as “Nesting.” In this example we have a four element list: (+) is the first element, the entire expression (* 3 2) is the second element, (/ 12 4) is the third, and 2 is the fourth. It is easy to see that (* 3 2) produces 6, (/ 12 4) produces 3, then adding 6, 3, and 2 give 11 as the result.

Be Sociable, Share!
  • more AutoLISP Internal Functions

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>