Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Backquote syntax {}

1 view
Skip to first unread message

Kelly Murray

unread,
Apr 19, 1999, 3:00:00 AM4/19/99
to
Just thought I'd post the ACL code to implement
the NiCLOS backquote syntax.
A further idea is to replace `(zap {(zip 1 2)} with just
`(zap {zip 1 2}) but this would be confused with a
function call of no args, e.g. `(zap {zip}) which
can be fixed by requiring the full paren form in this case:
`(zap {(zip)}). I haven't implemented this idea.

-Kelly Murray k...@niclos.com

The code below does the simple case, which makes the reader return
the same form as using , and ,@ so in fact, it
will print the form back using , and ,@ and not {} and {}*

(defun curl-reader-macro (stream char)
(declare (ignore char))
(when (<= excl::*backquote-count* 0)
(excl::internal-reader-error stream "{ not inside a backquote."))
(let* ((excl::*backquote-count* (1- excl::*backquote-count*))
(form (read stream t nil t)))
(case (peek-char nil stream t nil t)
(#\} (read-char stream t nil t)
(case (peek-char nil stream t nil t)
(#\*
(read-char stream t nil t)
(list 'excl::bq-comma-atsign form))
(t (list 'excl::bq-comma form))))
(t
(list 'excl::bq-comma form)))))

(set-macro-character #\{ 'curl-reader-macro nil)

0 new messages