Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:getting_started:lisp_crash_course [2022/05/03 20:43] – khoshnam | doc:getting_started:lisp_crash_course [2022/05/17 11:41] (current) – khoshnam | ||
---|---|---|---|
Line 912: | Line 912: | ||
<code lisp> | <code lisp> | ||
CL-USER> | CL-USER> | ||
- | CL-USER> | + | CL-USER> |
| | ||
(format t "~% a is more than 20")) | (format t "~% a is more than 20")) | ||
Line 940: | Line 940: | ||
<code lisp> | <code lisp> | ||
- | CL-USER> | + | CL-USER> |
CL-USER> | CL-USER> | ||
- | (progn (setf (number-was-odd t) | + | (progn (setf (*number-was-odd* t) |
‘odd-number) | ‘odd-number) | ||
‘even-number) | ‘even-number) | ||
Line 983: | Line 983: | ||
</ | </ | ||
- | <code lisp> | + | |
**defparameter** | **defparameter** | ||
\\ | \\ | ||
+ | <code lisp> | ||
CL-USER> | CL-USER> | ||
CL-USER> | CL-USER> | ||
Line 1061: | Line 1062: | ||
body-form*) | body-form*) | ||
</ | </ | ||
+ | The list-form will be the list of elements that are iterated\\ | ||
+ | The body-form are present in the loop | ||
<code lisp> | <code lisp> | ||
Line 1072: | Line 1075: | ||
**Dotimes** | **Dotimes** | ||
\\ | \\ | ||
- | With dotimes you can do looping for some fixed number of iterations. | + | With dotimes you can do looping for some fixed number of iterations. So the dotimes is quite similar to dolist, but you should consider that it loops for a particular number of times. |
<code lisp> | <code lisp> | ||
Line 1092: | Line 1095: | ||
\\ | \\ | ||
Do is more general than two others. | Do is more general than two others. | ||
+ | |||
+ | <code lisp> | ||
+ | CL-USER> | ||
+ | | ||
+ | body-form*) | ||
+ | </ | ||
+ | Var-form consists of some varibles that we defined and their initial values And how each iteration will affect it\\ | ||
+ | end-form composed of how the loop finish and value returned. It will evaluated at the start of the iteration. | ||
<code lisp> | <code lisp> |