(cond (;; $variable
(and (symbol? form)
(string=? (substring (symbol->string form) 0 1) "$")
- (not (string=? (substring (symbol->string form) 1 2) "$")))
+ (not (and (<= 2 (string-length (symbol->string form)))
+ (string=? (substring (symbol->string form) 1 2) "$"))))
(create-binding! (string->symbol (substring (symbol->string form) 1))))
(;; atom
(not (pair? form)) form)
(display (read-char port) out)) ;; pop the second $
;; a #scheme expression
((char=? c #\#)
- (format out "#~a" (remove-dollars! (read port))))
+ (let ((expr (read port)))
+ (format out "#~s" (if (eq? '$ expr)
+ (create-binding! (read port))
+ (remove-dollars! expr)))))
;; other caracters
(else
(display c out))))))))