@@ -12,6 +12,7 @@ written.
1212
1313~~~~ Commonlisp
1414(defun function-name (param1 param2 &key (keyword1 default-value))
15+ ;; keywords are optional; optional positional parameters are also available.
1516 ;; implicit progn
1617 )
1718~~~~
@@ -20,23 +21,23 @@ written.
2021
2122
2223~~~~ Commonlisp
23- (defmethod method-name ((object class-name)
24+ (defmethod method-name ((param1 class-name) )
2425 ;; implicit progn
2526 )
2627~~~~
2728
2829### Defining a class
2930
3031
31- Note that DEFCLASS accessor functions for slots can be SETF'd and serve as both getters and setters for the slot.
32+ Note that ` DEFCLASS ` accessor functions for slots can be ` SETF ` 'd and serve as both getters and setters for the slot.
3233
33- : INITARG is the keyword used in MAKE-INSTANCE to denote the value of the initial argument (see below).
34+ ` :INITARG ` is the keyword used in ` MAKE-INSTANCE ` to denote the value of the initial argument (see below).
3435
35- : INITFORM is the form used to initialize the slot. Without this, it defaults to ` nil ` . I favor using nil, 0, "" , or
36+ ` :INITFORM ` is the form used to initialize the slot. Without this, it defaults to ` nil ` . I favor using ` nil ` , ` 0 ` , ` "" ` , or
3637` (error "You must set slot <slotname> to a value") ` as the usual initform set.
3738
38- Note that ` (:documentation ...) ` is the standard documentation mechanism, which can be vuew in the running image with
39- DESCRIBE (at least in SBCL).
39+ Note that ` (:documentation ...) ` is the standard documentation mechanism, which can be viewed in the running image with
40+ ` DESCRIBE ` (at least in SBCL).
4041
4142~~~~ Commonlisp
4243
@@ -107,6 +108,9 @@ are my favorite LOOPs
107108
108109(loop for i from 0 upto 10
109110 collect i)
111+
112+ (loop for i from 0 below 10
113+ collect i)
110114
111115(loop for i from 0 upto 10
112116 do
@@ -116,7 +120,7 @@ are my favorite LOOPs
116120 collect
117121 (operate-on ele))
118122
119- (loop for ele in list
123+ (loop for ele across array
120124 collect
121125 (operate-on ele))
122126~~~~
@@ -126,13 +130,13 @@ are my favorite LOOPs
126130The lambda functions is an anonymous function, i.e., unnamed.
127131
128132Here we map over ` numeric-list ` and increment each element in it by 1
129- with ` INCF ` , returning the incremented list.
133+ with ` 1+ ` , returning the incremented list.
130134
131135~~~~ Commonlisp
132136
133137(mapcar
134138 #'(lambda (x)
135- (incf x))
139+ (1+ x))
136140 numeric-list)
137141
138142~~~~
@@ -156,6 +160,8 @@ for details on this very useful form.
156160
157161### Writing a text file
158162
163+ More complete reading and writing of text files can be done by using the ALEXANDRIA library; these
164+ routines are great for starting to customize your own routine.
159165
160166``` Commonlisp
161167(defun write-file (filename data)
0 commit comments