Open
Description
(via this comment on Reddit):
Mostly looks good, but I've got some style suggestions. Number one, I'd make constructors for your objects instead of inlining make-instance calls. For example:
(defun make-rect (x y w h)
(let ((r (make-instance 'rect :x1 x :y1 y)))
(setf (x2 r) (+ (x1 r) width)
(y2 r) (+ (y1 r) height)
(center r) (cons (floor (/ (+ (x1 r) (x2 r)) 2)) (floor (/ (+ (y1 r) (y2 r)) 2))))
rect))
I also rearranged some functions to suggest some style improvements. I'd try to minimize declaring variables just to setf them later... usually you can just add a nested let, or use let*.