Last active
August 29, 2015 21:44
-
-
Save zkat/48891 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun slate-dispatch (selector &rest args) | |
(let ((n (length args)) | |
(most-specific-method nil) | |
(ordering-stack nil)) | |
(loop for index upto n | |
do (let ((position 0)) | |
(push (elt args index) ordering-stack) | |
(loop while ordering-stack | |
do (let ((arg (pop ordering-stack))) | |
(loop for role in (roles arg) | |
(when (and (eql selector (name role)) | |
(eql index (role role))) | |
(setf most-specific-method (talent-pointer role)))) | |
(loop for delegation in (sheep-direct-parents arg) | |
do (push delegation ordering-stack)) | |
(setf position (1+ position)))))) | |
most-specific-method)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment