[gambit-list] Gambit Readtables

Guillaume Cartier gcartier at jazzscheme.org
Mon Jun 18 13:17:25 EDT 2007


I am trying to have my reatable recognize extra named chars like #\Home, 
#\End, ... but there's something I don't get...

In the following code:

----------------------

(include "~~/src/lib/header.scm")

(define extra-named-chars
  '(("Nul"   . #\x00)
    ("Home"  . #\x01)
    ("Enter" . #\x03)
    ("End"   . #\x04)))

(define (add-extra-named-chars! readtable)
  (macro-readtable-named-char-table-set! readtable
    (append (macro-readtable-named-char-table readtable)
            extra-named-chars)))

(define (make-my-readtable)
  (let ((readtable (##readtable-copy ##main-readtable)))
    (add-extra-named-chars! readtable)
    readtable))

(define (tr)
  (add-extra-named-chars! ##main-readtable))

(define (tr2)
  (set! ##main-readtable (make-my-readtable)))

----------------------

If I do (tr) then everything works perfectly, but using tr2 doesn't 
work, I get  Invalid '#\' name: "End"

Any clue?

Thanks,

Guillaume Cartier




More information about the Gambit-list mailing list