List Introduction

Mar 06

Functions

LISP is an acronym for LISt Processing and is a programming language that consists of only three elements: atoms, lists, and functions. An atom is the basic unit of any LISP program, simple defined as a single computer word or element. You could say that atoms represent the basic building elements of data in LISP.

A Function can be defined as a LISP program which always returns a result. Functions may be user defined or already built into AutoLISP such as the common math functions +, -, *, and /. Each function is called simply by giving its name as the first element of a list, with any arguments to that function as the subsequent elements of the list.

A list therefore, is a group of atoms that are contained within an opening parenthesis “(” and a closing parenthesis “)”. These lists may contain any number of reals, integers, strings, variables, or other lists and are treated as one expression stored in a single variable. Lists can be used to organize and process groups of information.

Sample list’s are:

(“A” “B”) ;;two elements

(table) ;;one element

((desk chair) (files)) ;;two elements

(1 (2 3) “test” (c d)) ;;four elements

Point Lists

Graphic coordinates such as 2D points are expressed as a list of two real numbers

(X Y), as in:

(12.435678 7.134000)

3D coordinates are expressed in the same manner with the third value of the list being the Z coordinate.

(12.435678 7.134000 1.000000)

This predefined structure, referred to as a point list, accommodates the interface between AutoLISP and AutoCAD.

Be Sociable, Share!
  • more List Introduction

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>