[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get-macro-character bug



>>>>> On Thu, 14 Nov 91 14:39:33 MST, ted@nmsu.edu said:

ted> get-macro-character character doesn't let you change #\\ to a
ted> character macro.  this is because it doesn't look in the right
ted> character attribute table for the attributes.

ted> the old version in code/reader.lisp is:

ted> (defun get-macro-character (char &optional rt)
ted>   "Returns the function associated with the specified char which is a macro
ted>   character.  The optional readtable argument defaults to the current
ted>   readtable."
ted>   (let ((rt (or rt *readtable*)))
ted>     ;; Check macro syntax, return associated function if it's there.
ted>     ;; Returns a value for all constituents.
ted>     (cond ((constituentp char)
ted>            (values (get-cmt-entry char rt) t))
ted>           ((terminating-macrop char)
ted>            (values (get-cmt-entry char rt) nil))
ted>           (t nil))))

ted> this should read:

ted> (defun get-macro-character (char &optional (rt *readtable*))
ted>   "Returns the function associated with the specified char which is a macro
ted>   character.  The optional readtable argument defaults to the current
ted>   readtable."
ted>   ;; Check macro syntax, return associated function if it's there.
ted>   ;; Returns a value for all constituents.
ted>   (cond ((constituentp char rt)
ted>          (values (get-cmt-entry char rt) t))
ted>         ((terminating-macrop char rt)
ted>          (values (get-cmt-entry char rt) nil))
ted>         (t nil)))

How about:

(defun get-macro-character (char &optional rt)
  "Returns the function associated with the specified char which is a macro
  character.  The optional readtable argument defaults to the current
  readtable."
  ;; Check macro syntax, return associated function if it's there.
  ;; Returns a value for all constituents.
  (let ((rt (or rt *readtable*)))
    (cond ((constituentp char rt)
	   (values (get-cmt-entry char rt) t))
	  ((terminating-macrop char rt)
	   (values (get-cmt-entry char rt) nil))
	  (t nil))))

You can't use the default for the &optional argument because it is
legal to explicitly specify NIL to mean the standard readtable.

-- Chris.