I am using common-lisp for my real-time graphics experiments and so far it has being great. My requirements for speed and easy compatibility with cffi mean I am using 'typed' arrays. The one area of the code which really feels ugly is the generic versions of my matrix and vector math functions. As CLOS cant specialize on length of an array I am doing something like this:
(defun v+ (vec-a vec-b)
(%v+ vec-a vec-b (length a) (length b)))
(defmethod %v+ (va vb (la (eql 3)) (lb (eql 3)))
***CODE HERE***)
This works but doesn't feel right. I have seen extensions to various CL implementations and heard about the promise of MOP.
I have steered away from this as I feared it would break functionality with some CL implementations but I have more recently seen the Closer-to-Mop project.
Core Question: Does MOP provide a more efficient method for specializing on length? Are there any area/techniques I should focus on?