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


The following example sets up a reader macro on the open bracket char
whose contract is to return a quoted list of the elements delimited by
the open bracket and the close bracket. Additionally, the keyword :FACT
is to be consed onto the front of the quoted list. (See CLtL 2ed, page
546 for a similar example). 

(defun open-bracket-macro-char (stream macro-char)
  (declare (ignore macro-char))
  (let ((l (read-delimited-list #\] stream t)))
    (values `(quote (:fact ,@l)))))

(set-macro-character #\[ #'open-bracket-macro-char)
(set-macro-character #\] (get-macro-character #\) ))

	(defvar zzz [foo bar baz])
should return
	(:fact foo bar baz)
but instead I get an error in the reader because the close bracket
delimiter is not being properly recognized. If a whitespace char is inserted
before the last element, as in
	(defvar zzz [foo bar baz ])
then all is well. But this is no "solution."

Is this an error in my code or in the implementation of read-delimited-list?
I don't think Symbolics implements the close parenthesis as a macro character
so (set-macro-character #\] (get-macro-character #\) )) is not doing anything
useful. If read-delimited-list is at fault, does anybody have a decent
workaround? Note well that I am still using Genera 7.2.

	Len Charest	JPL AI Lab