Commit 0a549581 authored by Pascal J. Bourguignon's avatar Pascal J. Bourguignon

Added undefmethod.

parent 0d42f981
......@@ -224,7 +224,7 @@ RETURN: A new list of name and aliases, with the ALIASES added, if
(list (mapcar (lambda (x) (mapcar (function string-upcase) (first x)))
#-(or ccl clisp cmu sbcl)
#-(or ccl clisp cmu ecl sbcl)
(warn "What are the available external formats in ~A ?"
;;;; -*- mode:lisp;coding:utf-8 -*-
;;;;FILE: undefmethod.lisp
;;;;LANGUAGE: Common-Lisp
;;;;SYSTEM: Common-Lisp
;;;; A macro to undefine methods.
;;;; <PJB> irc://[email protected] <[email protected]>
;;;; 2014-12-26 <PJB> Imported Shinmera's undefmethod from his paste
;;;; GPL3
;;;; Copyright Copyright irc://[email protected] 2014 - 2014
;;;; This program is free software: you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation, either version 3 of the License, or
;;;; (at your option) any later version.
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; GNU General Public License for more details.
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program. If not, see <>.
(:use "COMMON-LISP")
(:export "UNDEFMETHOD")
(:documentation "
;; Find your defmethod
(defmethod find-place ((switch string) place)
(gethash string place))
;; Change to undefmethod
(undefmethod find-place ((switch string) place)
(gethash string place))
;; Hit C-c C-c again and gone it is!
Copyright irc://[email protected]
(defmacro undefmethod (name &rest args)
(flet ((lambda-keyword-p (symbol)
(find symbol lambda-list-keywords)))
(destructuring-bind (qualifiers args) (loop for thing = (pop args)
until (listp thing)
collect thing into qualifiers
finally (return (list qualifiers thing)))
(mapcar #'find-class
',(loop for arg in args
until (lambda-keyword-p arg)
collect (if (listp arg) (second arg) T))))))))
;;;; THE END ;;;;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment