Master the building blocks of AutoLISP: atoms, lists, functions, and how evaluation works.
📚 What You’ll Learn
By the end of this lesson, you’ll be able to:
Understand what atoms and lists are in LISP
Write simple AutoLISP expressions using correct syntax
Grasp how AutoLISP evaluates expressions using parentheses
Read and debug basic AutoLISP code confidently
🧠 Why It Matters
AutoLISP is a list-based language where everything is an expression. Once you understand how LISP reads and evaluates its code, writing and debugging scripts becomes easier and more predictable. This lesson is essential for building confidence in writing your own routines.
🛠️ Tools You’ll Use
Tool / Feature
Purpose
LISP Expressions
Learn the basic structure of all AutoLISP code
Command Line
Test expressions and evaluate results
PRINT, PRINC
Output results of expressions
QUOTE
Prevent evaluation to view data as-is
🧭 Lesson Structure
1️⃣ What Is an Atom?
An atom is a single element in LISP. It can be:
Type
Example
Description
Number
5, -2.75
A numeric value
Symbol
x, pt1
Variable or function name
String
"Hello"
Text enclosed in quotes
Boolean
T, NIL
T = true, NIL = false or empty list
Atoms are the smallest units of information in AutoLISP.
2️⃣ What Is a List?
A list is a group of items enclosed in parentheses. In AutoLISP, all code is written in list form:
(+ 2 3) ; This is a list with function "+" and two arguments
Example
Meaning
(+ 2 3)
Add 2 and 3 → returns 5
(* 4 2)
Multiply 4 and 2 → returns 8
(setq x 10)
Assign value 10 to variable x
📌 Lists are always written in prefix notation:
(operator operand1 operand2 ...)
3️⃣ Parentheses and Evaluation
AutoLISP evaluates the first element in a list as a function or operator.
(+ 2 2) ; "+" is the function, 2 and 2 are the arguments (setq a 5) ; "setq" sets variable a to 5
Rule
Example
First item = function
(+ 1 2) → returns 3
Inner lists are evaluated first (nested)
(+ (* 2 2) 3) → 7
Quotes prevent evaluation
'(1 2 3) → returns list
(setq pt '(10 20)) ; pt is a list containing 10 and 20