Регистрация | Войти
Lisp — программируемый язык программирования
ugly nicknames
Автор: Menschenkindlein - 2013-01-23T13:56:14.000000+04:00
(defpackage #:ugly-nicknames
  (:use #:cl)
  (:export #:add-ugly-nickname-for-package)
)


(in-package #:ugly-nicknames)

(defvar *nicknames* (make-hash-table :test #'equalp))

(defun read-word (str)
  (coerce
   (loop for char = (read-char str)
      until (char= char #\:)
      collecting char
)

   'string
)
)


(set-dispatch-macro-character #\# #\@
    (lambda (str subchar arg)
      (declare (ignore subchar arg))
      (let ((*package* (find-package (gethash (read-word str)
                                              *nicknames*
)
)
)
)

        (read str)
)
)
)


((defun add-ugly-nickname-for-package (nickname target-package)
  (setf (gethash nickname *nicknames*) target-package)
)

@2009-2013 lisper.ru