Search found 64 matches
- Thu Jul 31, 2008 9:27 pm
- Forum: Common Lisp
- Topic: define-compiler-macro
- Replies: 11
- Views: 29633
Re: define-compiler-macro
Thx :D But i still don't understand exactly how to shadow the function name with the compiler-macro. Looking at the documentation, it appears you have to (funcall (compiler-macro-function 'name) (name args) nil) where name is the name of the compiler-macro. If i define a function with the same name...
- Tue Jul 29, 2008 5:52 pm
- Forum: Common Lisp
- Topic: Accessing parent objects in CLOS
- Replies: 7
- Views: 13849
Re: Accessing parent objects in CLOS
If there is only going to be one game object, you could use a global variable.
Also, in your move-ball method, I think it would be better to dispatch when the ball variable is a subtype of ball instead of T.
Also, in your move-ball method, I think it would be better to dispatch when the ball variable is a subtype of ball instead of T.
- Wed Jul 16, 2008 11:32 am
- Forum: Common Lisp
- Topic: copy-list vs. copy-tree
- Replies: 5
- Views: 18677
Re: copy-list vs. copy-tree
Another way to see the difference: CL-USER 3 > (let* ((original (list (list 'a) 'c)) (copy-list (copy-list original)) (copy-tree (copy-tree original))) (setf (caar original) 'b) (print copy-list) (print copy-tree) (values)) ((B) C) ((A) C) Notice how copy-list shares the '(a) cons with the original ...
- Wed Jul 16, 2008 10:54 am
- Forum: Common Lisp
- Topic: closures
- Replies: 6
- Views: 17603
Re: closures
Closures can be powerful, but typically you wouldn't see top level functions be closures; in this example, what if you wanted two counters? You could do something like this: CL-USER 12 > (defun make-counter () (let ((count 0)) (lambda (operation) (case operation (increment (incf count)) (reset (setf...