diff --git a/src/ikarus.boot b/src/ikarus.boot index 0db4518..168910d 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ diff --git a/src/ikarus.pretty-print.ss b/src/ikarus.pretty-print.ss index c4953e8..70c3a4c 100644 --- a/src/ikarus.pretty-print.ss +++ b/src/ikarus.pretty-print.ss @@ -506,6 +506,9 @@ (set-fmt! 'unquote-splicing '(read-macro . ",@")) (set-fmt! 'quasiquote '(read-macro . "`")) (set-fmt! 'syntax '(read-macro . "#'")) + (set-fmt! 'quasisyntax '(read-macro . "#`")) + (set-fmt! 'unsyntax '(read-macro . "#,")) + (set-fmt! 'unsyntax-splicing '(read-macro . "#,@")) (set-fmt! '|#primitive| '(read-macro . "#%")) (set-fmt! 'let '(alt (_ (0 [e 0 e] ...) tab e ...) diff --git a/src/ikarus.writer.ss b/src/ikarus.writer.ss index 5ee2e28..169e325 100644 --- a/src/ikarus.writer.ss +++ b/src/ikarus.writer.ss @@ -421,27 +421,37 @@ (loop x 0 (string-length x) p))) (define macro - (lambda (x) + (lambda (x h) (define macro-forms - '([quote . "'"] - [quasiquote . "`"] - [unquote . ","] - [unquote-splicing . ",@"] - [syntax . "#'"] + '([quote . "'"] + [quasiquote . "`"] + [unquote . ","] + [unquote-splicing . ",@"] + [syntax . "#'"] + [quasisyntax . "#`"] + [unsyntax . "#,"] + [unsyntax-splicing . "#,@"] [|#primitive| . "#%"])) (and (pair? x) (let ([d ($cdr x)]) (and (pair? d) - (null? ($cdr d)))) + (null? ($cdr d)) + (not (get-hash-table h x #f)))) (assq ($car x) macro-forms)))) (define write-pair (lambda (x p m h i) - (write-char #\( p) - (let ([i (writer (car x) p m h i)]) - (let ([i (write-list (cdr x) p m h i)]) - (write-char #\) p) - i)))) + (cond + [(macro x h) => + (lambda (a) + (display (cdr a) p) + (writer (cadr x) p m h i))] + [else + (write-char #\( p) + (let ([i (writer (car x) p m h i)]) + (let ([i (write-list (cdr x) p m h i)]) + (write-char #\) p) + i))]))) (define write-ref (lambda (n p)