The interpreter does the following:
evaluate 5 as 5 and 2 as 2
applies those numbers to the * function and evaluate it as 10
evaluate 3 as 3 and 2 as 2
applies those numbers to the + function and evaluate it as 5
applies the evaluated 10 and 5 to the + function and evaluate it as 15
Autolisp evaluation
Evaluation is actually the result of an expression or any data within a parenthesis. Note that arguments evaluated first and then applied to the function.
Evaluation prevention
Autolisp evaluate everything by its nature, so there is a need to control when we don't want things to be evaluated or skipped by the interpreter.
To prevent evaluation we use the Quote function
(Quote (a b)) or '(a b)
Variables
Variables are container to hold data. A name of a variable is always the same but the value can be change by user manipulation only.
Data types
Integer
An integer is a whole number without a decimal point and its range between 32000 to -32000. If an equation that emulate to a number with a decimal point its being dropped out, for example
(/ 15 2) evaluate to 7
Integers are evaluated to themselves.
Real
Is a number with decimal point .
(/15 2) 7.5
Note that values between 0.0 and 1.0 must start with 0 or 1,
Not .425 but 0.425.
String
A string is a sequence of data types so called characters.
Lists
Can be treated as a container that holds all kind of data types and even other lists.
Assigning values to variables
Assigning values to variables is issued by two functions combination, set and quote which form one function setq .
set means set the value of the first argument to be equal to the evaluation of the second argument.
Quote means don't evaluate the first argument
Setq means set the value of the first argument to be equal to the evaluation of the second argument but don't evaluate the first argument.
The argument in the right is evaluated first and sent to the setq function which first preventing the evaluation of v and set the value of v to be equal to 0.734.
Another example is when we want to add value to existing vakue of a variable
The argument is evaluated first and then sent to setq function, which in turn don't evaluate the first argument but assigning the second to the first)