2. overview Forms Variables Macros Function calls Named functions Lambda expressions Top-level forms Declaring global variables and named constants Control of time and evaluation
5. ListsLists can further be divided as: special forms, macro calls and function calls. All characters, numbers, string, and bit-vectors are all self-evaluating forms. When such an object is evaluated, that object is returned as the value of the form.
6.
7.
8.
9. If the macro-function is true of the symbol, apply either macro-expand or macroexpand-1, as appropriate to the entire form and then start over.
10.
11. Function calls While the list is being evaluated as a form, if the first element is not a symbol that names a special form or a macro, the it is considered as a function call. The first element of the list is taken as the name of the function. All the remaining elements of the list are evaluated and one value is obtained from each form, and these values become the arguments to the function. Whatever values the function returns becomes the values of the function-call forms.
12. Function calls continued.. Ex: (+ 3 (* 1 2)) here, + is not a special form or macro. So 3 and (* 1 2) are considered as arguments of the function call, again 1 2 are taken as arguments of the function call (* 1 2) and the value 2 is returned. The values 2 and 3 are given as arguments for the addition function to produce the result 5. Thus, ( + 3 (* 1 2))ïš5
13.
14. using a lambda-expression whose first element in the list is lambda.Lambda expressions or the symbols when used in programs as the name of the functions, can appear only as the first element of the function-call form, or the second element of the function special form. A global name can be given to a function using the defun construct. A local name is given to the function using the flet or labels construct.
15. Lambda-expressions A lambda-expression has the following syntax: (lambda lambda-list .body) The first element must be lambda, the second element must be the list, and specifies names for the parameters of the list The body may consists of zero or more number of forms. Each element in the lambda-list is either a parameter specifier or the lambda-list keyword. (lambda-list keywords begin with &) Var or svar must be a symbol( the name of the variable), Each keyword must be a keyword symbol, such as :start
16. A lambda-list has five parts Specifiers for the required parameters: these are parameter specifiers up to the first lambda-list keyword. Specifiers for the optional parameters: these are the specifiers following the lambda-list keyword &optional up to the next lambda-list keyword or the end of the list. A specifier for a rest parameter Specifiers for the keyword parameters Specifiers for the aux parameters: If the lambda-list keyword &key is present, all specifiers after it are auxiliary variable specifiers.
20. Define global values for special variablesIf progn appears at top-level, then all forms within that progn are considered by the compiler to be top-level forms.
21. Defining named functions defun special form is used for defining named functions. evaluating the defun form causes the symbol name to be a global name for the function specified by the lambda-expression. (defun (setf cadr)âŠ) is used to define a setf expansion function to cadr. Forms constitute the body of the defined function, they are executed as an implicit progn. defun name lambda-list [[ {declaration}* | doc-string]] {form}*
24. defconstant (used for defining named constants)Syntax: defvar name [initial-value [documentation]] defparameter name initial-value [documentation] defconstant name initial-value [documentation]
25. (defvar variable) proclaims the variable to be special. defvar also gives a good option to provide the comment for the variable Ex: (defvar *visible-windows* 0 ânumber of visual windows at least partially visible on the screenâ) defparameter is similar to defvar, but it requires an initial value-form, always evaluates the form, and assigns the result to the variable. defconstant is like defparameter but does assert that the value of the variable name is fixed and does license the compiler to build assumptions about the value into program being compiled.
26. Control of time and execution The eval-when special code allows pieces of code to be executed only at compile-time, only at load time, or when interrupted but not compiled. ïševal-when ({situation}*) {from}* The body of the eval-when form is processed as an implicit progn only if the situation is a symbol, either compile, eval or load. Eval specifies that the interpreter should process the body. Compile specifies that the compiler should evaluate the body at compile time. Load specifies that the compiler should arrange to evaluate the forms in the body when the compiled file containing the eval-when form is loaded.
27.
28. if the situation compile is specified, or if the current processing mode is compile-time-too and the situation eval is specified, the process each of the forms in the body in compile-time-too mode.
29. else, process each of the forms in the body in not-compile-time mode
31. if the situation compile is specified, or if the current processing mode is compile-time-too and the situation eval is specified, then evaluate each of the forms in the body in the compilerâs executing environment.
32.
33. Visit more self help tutorials Pick a tutorial of your choice and browse through it at your own pace. The tutorials section is free, self-guiding and will not involve any additional support. Visit us at www.dataminingtools.net